up
This commit is contained in:
@@ -1,14 +1,15 @@
|
|||||||
import { Entity, Enum, ManyToOne, Property } from '@mikro-orm/core';
|
import { Entity, Enum, Index, ManyToOne, Property, Unique } from '@mikro-orm/core';
|
||||||
import { BaseEntity } from '../../../common/entities/base.entity';
|
import { BaseEntity } from '../../../common/entities/base.entity';
|
||||||
import { Restaurant } from 'src/modules/restaurants/entities/restaurant.entity';
|
import { Restaurant } from 'src/modules/restaurants/entities/restaurant.entity';
|
||||||
import { PaymentGatewayEnum, PaymentMethodEnum } from '../interface/payment';
|
import { PaymentGatewayEnum, PaymentMethodEnum } from '../interface/payment';
|
||||||
|
|
||||||
@Entity({ tableName: 'payment_methods' })
|
@Entity({ tableName: 'payment_methods' })
|
||||||
|
@Unique({ properties: ['restaurant', 'method'] })
|
||||||
|
@Index({ properties: ['restaurant', 'enabled'] })
|
||||||
export class PaymentMethod extends BaseEntity {
|
export class PaymentMethod extends BaseEntity {
|
||||||
@ManyToOne(() => Restaurant)
|
@ManyToOne(() => Restaurant)
|
||||||
restaurant!: Restaurant;
|
restaurant!: Restaurant;
|
||||||
|
|
||||||
|
|
||||||
@Enum(() => PaymentMethodEnum)
|
@Enum(() => PaymentMethodEnum)
|
||||||
method!: PaymentMethodEnum;
|
method!: PaymentMethodEnum;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user