order refactored

This commit is contained in:
2026-02-09 14:47:03 +03:30
parent 626d8194d8
commit ff7d2c912a
12 changed files with 52 additions and 412 deletions
@@ -1,17 +1,15 @@
import { Entity, Index, ManyToOne, Property } from '@mikro-orm/core';
import { BaseEntity } from '../../../common/entities/base.entity';
import { Order } from './order.entity';
import { Product } from '../../products/entities/product.entity';
import { Variant } from '../../products/entities/variant.entity';
@Entity({ tableName: 'order_items' })
@Index({ properties: ['order'] })
@Index({ properties: ['product'] })
export class OrderItem extends BaseEntity {
@ManyToOne(() => Order)
order!: Order;
@ManyToOne(() => Product)
product!: Product;
@ManyToOne(() => Variant)
variant!: Variant;
@Property({ type: 'int' })
quantity!: number;