generate code
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Entity, ManyToOne, Property, Enum } from '@mikro-orm/core';
|
||||
import { Entity, ManyToOne, Property, Enum, Unique } from '@mikro-orm/core';
|
||||
import { BaseEntity } from '../../../common/entities/base.entity';
|
||||
import { Restaurant } from '../../restaurants/entities/restaurant.entity';
|
||||
|
||||
@@ -8,11 +8,12 @@ export enum CouponType {
|
||||
}
|
||||
|
||||
@Entity({ tableName: 'coupons' })
|
||||
@Unique({ properties: ['code', 'restaurant'] })
|
||||
export class Coupon extends BaseEntity {
|
||||
@ManyToOne(() => Restaurant)
|
||||
restaurant!: Restaurant;
|
||||
|
||||
@Property({ unique: true })
|
||||
@Property()
|
||||
code!: string;
|
||||
|
||||
@Property()
|
||||
|
||||
Reference in New Issue
Block a user