generate code

This commit is contained in:
2025-12-06 16:40:26 +03:30
parent 7440d4db90
commit 8768cd9961
3 changed files with 19 additions and 3 deletions
@@ -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()