order number
This commit is contained in:
@@ -6,7 +6,8 @@ import {
|
||||
Enum,
|
||||
PrimaryKey,
|
||||
OptionalProps,
|
||||
OneToOne
|
||||
OneToOne,
|
||||
Opt
|
||||
} from '@mikro-orm/core';
|
||||
import { User } from '../../user/entities/user.entity';
|
||||
import { ulid } from 'ulid';
|
||||
@@ -21,9 +22,9 @@ import { OrderPrint } from './print.entity';
|
||||
@Entity({ tableName: 'orders' })
|
||||
@Index({ properties: ['user'] })
|
||||
export class Order extends BaseEntity {
|
||||
[OptionalProps]?: 'createdAt' | 'deletedAt' | 'orderNumber'
|
||||
[OptionalProps]?: 'createdAt' | 'deletedAt'
|
||||
|
||||
@ManyToOne(() => InvoiceItem,{nullable:true})
|
||||
@ManyToOne(() => InvoiceItem, { nullable: true })
|
||||
invoiceItem?: InvoiceItem
|
||||
|
||||
@ManyToOne(() => Product, { nullable: true })
|
||||
@@ -37,10 +38,10 @@ export class Order extends BaseEntity {
|
||||
id: string = ulid()
|
||||
|
||||
@Property({ type: 'string', nullable: true })
|
||||
title?: string
|
||||
title?: string
|
||||
|
||||
@ManyToOne(() => Category)
|
||||
type: Category
|
||||
type: Category
|
||||
|
||||
@ManyToOne(() => User)
|
||||
user!: User;
|
||||
@@ -53,9 +54,9 @@ export class Order extends BaseEntity {
|
||||
|
||||
@Property({
|
||||
type: 'int',
|
||||
autoincrement: true
|
||||
unique: true
|
||||
})
|
||||
orderNumber: number;
|
||||
orderNumber: number & Opt;
|
||||
|
||||
|
||||
@Enum(() => OrderStatusEnum)
|
||||
@@ -67,5 +68,5 @@ export class Order extends BaseEntity {
|
||||
@Property({ type: 'json' })
|
||||
attachments: IAttachment[] = []
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user