order
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import { Entity, ManyToOne, OptionalProps, Property } from '@mikro-orm/core';
|
||||
import { Collection, Entity, ManyToOne, OptionalProps, Property,OneToMany } from '@mikro-orm/core';
|
||||
import { Product } from 'src/modules/product/entities/product.entity';
|
||||
import { BaseEntity } from 'src/common/entities/base.entity';
|
||||
import { Invoice } from './invoice.entity';
|
||||
import { Order } from 'src/modules/order/entities/order.entity';
|
||||
|
||||
|
||||
@Entity({ tableName: 'invoice_items' })
|
||||
@@ -14,11 +15,14 @@ export class InvoiceItem extends BaseEntity {
|
||||
@ManyToOne(() => Product)
|
||||
product!: Product;
|
||||
|
||||
@OneToMany(() => Order, order => order.invoiceItem)
|
||||
orders = new Collection<Order>(this);
|
||||
|
||||
|
||||
@Property({ type: 'int' })
|
||||
quantity!: number;
|
||||
|
||||
@Property({ type: 'int'})
|
||||
@Property({ type: 'int' })
|
||||
unitPrice: number;
|
||||
|
||||
@Property({
|
||||
|
||||
Reference in New Issue
Block a user