review
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user