25 lines
825 B
TypeScript
25 lines
825 B
TypeScript
import { Entity, ManyToOne, Unique, Property } from '@mikro-orm/core';
|
|
import { BaseEntity } from '../../../common/entities/base.entity';
|
|
import { Restaurant } from '../../restaurants/entities/restaurant.entity';
|
|
import { PaymentMethod } from './payment-method.entity';
|
|
|
|
@Entity({ tableName: 'restaurant_payment_methods' })
|
|
@Unique({ properties: ['restaurant', 'paymentMethod'] })
|
|
export class RestaurantPaymentMethod extends BaseEntity {
|
|
@ManyToOne(() => Restaurant)
|
|
restaurant!: Restaurant;
|
|
|
|
@ManyToOne(() => PaymentMethod)
|
|
paymentMethod!: PaymentMethod;
|
|
|
|
// Add merchant ID for payment gateway providers (e.g., ZarinPal)
|
|
@Property({ nullable: true })
|
|
merchantId?: string;
|
|
|
|
@Property({ nullable: true })
|
|
callbackUrl?: string;
|
|
|
|
@Property({ type: 'boolean', default: true })
|
|
isActive: boolean = true;
|
|
}
|