fixing: get product
This commit is contained in:
@@ -3,6 +3,7 @@ import { Product } from './product.entity';
|
||||
import { BaseModel } from '../../config/basemodel.entity';
|
||||
import { productType } from '../../helper/enum-list';
|
||||
import { User } from '../../users/entities/user.entity';
|
||||
import { Partner } from '../../users/entities/partner.entity';
|
||||
|
||||
@Entity()
|
||||
export class ProductHistoryPrice extends BaseModel {
|
||||
@@ -12,8 +13,8 @@ export class ProductHistoryPrice extends BaseModel {
|
||||
@ManyToOne(() => Product, (product) => product.id)
|
||||
product: Product;
|
||||
|
||||
@ManyToOne(() => User, (user) => user.id)
|
||||
user: User;
|
||||
@ManyToOne(() => Partner, (partner) => partner.id)
|
||||
partner: Partner;
|
||||
|
||||
@Column()
|
||||
price: number;
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
import { ProductSubCategories } from './product-sub-category.entity';
|
||||
import { BaseModel } from '../../config/basemodel.entity';
|
||||
import { Supplier } from '../../users/entities/supplier.entity';
|
||||
import { ProductHistoryPrice } from './product-history-price.entity';
|
||||
|
||||
@Entity()
|
||||
export class Product extends BaseModel {
|
||||
@@ -54,4 +55,16 @@ export class Product extends BaseModel {
|
||||
},
|
||||
)
|
||||
supplier: Supplier;
|
||||
|
||||
@OneToMany(
|
||||
() => {
|
||||
return ProductHistoryPrice;
|
||||
},
|
||||
(php) => {
|
||||
return php.product;
|
||||
},
|
||||
)
|
||||
priceHistory: ProductHistoryPrice;
|
||||
|
||||
currentPrice: ProductHistoryPrice;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user