order
This commit is contained in:
@@ -1,7 +1,8 @@
|
|||||||
import { Entity, Index, ManyToOne, Property } from '@mikro-orm/core';
|
import { Entity, Enum, Index, ManyToOne, Property } from '@mikro-orm/core';
|
||||||
import { BaseEntity } from '../../../common/entities/base.entity';
|
import { BaseEntity } from '../../../common/entities/base.entity';
|
||||||
import { Order } from './order.entity';
|
import { Order } from './order.entity';
|
||||||
import { product } from 'src/modules/product/entities/product.entity';
|
import { product } from 'src/modules/product/entities/product.entity';
|
||||||
|
import { OrderItemStatus } from '../interface/order.interface';
|
||||||
|
|
||||||
@Entity({ tableName: 'order_items' })
|
@Entity({ tableName: 'order_items' })
|
||||||
@Index({ properties: ['order'] })
|
@Index({ properties: ['order'] })
|
||||||
@@ -27,4 +28,7 @@ export class OrderItem extends BaseEntity {
|
|||||||
|
|
||||||
@Property({ nullable: true })
|
@Property({ nullable: true })
|
||||||
description?: string;
|
description?: string;
|
||||||
|
|
||||||
|
@Enum(() => OrderItemStatus)
|
||||||
|
status!: OrderItemStatus;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,4 +7,7 @@ export enum OrderStatus {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export enum OrderItemStatus {
|
||||||
|
PENDING = 'pending',
|
||||||
|
VERIFIED = 'verified',
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,14 +1,9 @@
|
|||||||
import { Entity, Enum, Index, ManyToOne, Property, Unique } 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 { 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)
|
|
||||||
restaurant!: Restaurant;
|
|
||||||
|
|
||||||
@Enum(() => PaymentMethodEnum)
|
@Enum(() => PaymentMethodEnum)
|
||||||
method!: PaymentMethodEnum;
|
method!: PaymentMethodEnum;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ export class Payment extends BaseEntity {
|
|||||||
amount!: number;
|
amount!: number;
|
||||||
|
|
||||||
@Property({ unique: true, nullable: true })
|
@Property({ unique: true, nullable: true })
|
||||||
referenceId?: string | null;
|
token?: string | null;
|
||||||
|
|
||||||
@Enum(() => PaymentMethodEnum)
|
@Enum(() => PaymentMethodEnum)
|
||||||
method!: PaymentMethodEnum;
|
method!: PaymentMethodEnum;
|
||||||
@@ -27,9 +27,6 @@ export class Payment extends BaseEntity {
|
|||||||
@Enum(() => PaymentStatusEnum)
|
@Enum(() => PaymentStatusEnum)
|
||||||
status!: PaymentStatusEnum;
|
status!: PaymentStatusEnum;
|
||||||
|
|
||||||
@Property({ nullable: true })
|
|
||||||
cardPan?: string | null = null;
|
|
||||||
|
|
||||||
@Property({ type: 'json', nullable: true })
|
@Property({ type: 'json', nullable: true })
|
||||||
verifyResponse?: Record<string, any> | null = null;
|
verifyResponse?: Record<string, any> | null = null;
|
||||||
|
|
||||||
@@ -39,6 +36,4 @@ export class Payment extends BaseEntity {
|
|||||||
@Property({ nullable: true })
|
@Property({ nullable: true })
|
||||||
failedAt?: Date | null = null;
|
failedAt?: Date | null = null;
|
||||||
|
|
||||||
@Property({ nullable: true })
|
|
||||||
description?: string | null = null;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ export class Ticket extends BaseEntity {
|
|||||||
user: User;
|
user: User;
|
||||||
|
|
||||||
@ManyToOne(() => Ticket)
|
@ManyToOne(() => Ticket)
|
||||||
parent: Ticket[];
|
parent: Ticket|null;
|
||||||
|
|
||||||
@Property({ type: 'json' })
|
@Property({ type: 'json' })
|
||||||
attachments: string[]
|
attachments: string[]
|
||||||
|
|||||||
Reference in New Issue
Block a user