order
This commit is contained in:
@@ -0,0 +1,15 @@
|
|||||||
|
import {
|
||||||
|
Entity,
|
||||||
|
Property,
|
||||||
|
OptionalProps,
|
||||||
|
} from '@mikro-orm/core';
|
||||||
|
import { BaseEntity } from 'src/common/entities/base.entity';
|
||||||
|
|
||||||
|
@Entity({ tableName: 'order_types' })
|
||||||
|
export class OrderType extends BaseEntity {
|
||||||
|
[OptionalProps]?: 'createdAt' | 'deletedAt'
|
||||||
|
|
||||||
|
@Property({ type: 'string' })
|
||||||
|
title: string
|
||||||
|
|
||||||
|
}
|
||||||
@@ -15,6 +15,7 @@ import { OrderStatusEnum } from '../interface/order.interface';
|
|||||||
import { InvoiceItem } from 'src/modules/invoice/entities/invoice-item.entity';
|
import { InvoiceItem } from 'src/modules/invoice/entities/invoice-item.entity';
|
||||||
import { IField } from 'src/modules/request/interface/request.interface';
|
import { IField } from 'src/modules/request/interface/request.interface';
|
||||||
import { Product } from 'src/modules/product/entities/product.entity';
|
import { Product } from 'src/modules/product/entities/product.entity';
|
||||||
|
import { OrderType } from './order-type.entity';
|
||||||
|
|
||||||
@Entity({ tableName: 'orders' })
|
@Entity({ tableName: 'orders' })
|
||||||
@Index({ properties: ['user'] })
|
@Index({ properties: ['user'] })
|
||||||
@@ -30,6 +31,11 @@ export class Order extends BaseEntity {
|
|||||||
@PrimaryKey({ type: 'string', columnType: 'char(26)' })
|
@PrimaryKey({ type: 'string', columnType: 'char(26)' })
|
||||||
id: string = ulid()
|
id: string = ulid()
|
||||||
|
|
||||||
|
@Property({ type: 'string', nullable: true })
|
||||||
|
title?: string
|
||||||
|
|
||||||
|
@ManyToOne(() => OrderType)
|
||||||
|
type: OrderType
|
||||||
|
|
||||||
@ManyToOne(() => User)
|
@ManyToOne(() => User)
|
||||||
user!: User;
|
user!: User;
|
||||||
|
|||||||
Reference in New Issue
Block a user