This commit is contained in:
2025-12-07 13:00:37 +03:30
parent 1dc1eaad9a
commit a945138543
13 changed files with 360 additions and 316 deletions
@@ -0,0 +1,34 @@
import { Entity, ManyToOne, Property, Unique } from '@mikro-orm/core';
import { BaseEntity } from '../../../common/entities/base.entity';
import { Food } from '../../foods/entities/food.entity';
import { User } from '../../users/entities/user.entity';
import { Order } from 'src/modules/orders/entities/order.entity';
@Entity({ tableName: 'food_comments' })
@Unique({ properties: ['order', 'food', 'user'] })
export class Review extends BaseEntity {
@ManyToOne(() => Order)
order: Order;
@ManyToOne(() => Food)
food: Food;
@ManyToOne(() => User)
user: User;
@Property({ type: 'text', nullable: true })
comment?: string;
@Property({ type: 'int', nullable: false })
rating: number = 0;
@Property({ type: 'json', nullable: true })
positivePoints?: string[];
@Property({ type: 'json', nullable: true })
negativePoints?: string[];
@Property({ type: 'boolean', default: false })
isApproved: boolean = false;
}