payment
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import { Entity, Property } from '@mikro-orm/core';
|
||||
import { BaseEntity } from '../../../common/entities/base.entity';
|
||||
import { ObjectType, Field, Int } from '@nestjs/graphql';
|
||||
|
||||
@ObjectType()
|
||||
@Entity({ tableName: 'payment_methods' })
|
||||
export class PaymentMethod extends BaseEntity {
|
||||
@Field()
|
||||
@Property()
|
||||
name!: string;
|
||||
|
||||
@Field()
|
||||
@Property()
|
||||
keyName!: string;
|
||||
|
||||
@Field({ nullable: true })
|
||||
@Property({ nullable: true })
|
||||
description?: string;
|
||||
|
||||
@Field({ nullable: true })
|
||||
@Property({ nullable: true })
|
||||
icon?: string;
|
||||
|
||||
@Field(() => Boolean)
|
||||
@Property({ default: true })
|
||||
isActive: boolean = true;
|
||||
|
||||
@Field(() => Int, { nullable: true })
|
||||
@Property({ type: 'int', nullable: true })
|
||||
order?: number;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import { ObjectType, Field, Int } from '@nestjs/graphql';
|
||||
|
||||
@ObjectType()
|
||||
export class Payment {
|
||||
@Field(() => Int, { description: 'Example field (placeholder)' })
|
||||
exampleField: number;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
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';
|
||||
import { ObjectType, Field } from '@nestjs/graphql';
|
||||
|
||||
@ObjectType()
|
||||
@Entity({ tableName: 'restaurant_payment_methods' })
|
||||
@Unique({ properties: ['restaurant', 'paymentMethod'] })
|
||||
export class RestaurantPaymentMethod extends BaseEntity {
|
||||
@ManyToOne(() => Restaurant)
|
||||
restaurant!: Restaurant;
|
||||
|
||||
@Field(() => PaymentMethod, { nullable: true })
|
||||
@ManyToOne(() => PaymentMethod)
|
||||
paymentMethod!: PaymentMethod;
|
||||
|
||||
// Add merchant ID for payment gateway providers (e.g., ZarinPal)
|
||||
@Field({ nullable: true })
|
||||
@Property({ nullable: true })
|
||||
merchantId?: string;
|
||||
|
||||
@Field({ nullable: true })
|
||||
@Property({ type: 'boolean', default: true })
|
||||
isActive: boolean = true;
|
||||
}
|
||||
Reference in New Issue
Block a user