This commit is contained in:
2026-02-19 11:58:31 +03:30
parent 6836d34967
commit 4953bed42c
2 changed files with 21 additions and 0 deletions
@@ -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 { IField } from 'src/modules/request/interface/request.interface';
import { Product } from 'src/modules/product/entities/product.entity';
import { OrderType } from './order-type.entity';
@Entity({ tableName: 'orders' })
@Index({ properties: ['user'] })
@@ -30,6 +31,11 @@ export class Order extends BaseEntity {
@PrimaryKey({ type: 'string', columnType: 'char(26)' })
id: string = ulid()
@Property({ type: 'string', nullable: true })
title?: string
@ManyToOne(() => OrderType)
type: OrderType
@ManyToOne(() => User)
user!: User;