fixing: get product

This commit is contained in:
ilham
2021-12-14 21:48:21 +07:00
parent ff60406af2
commit 6f1f82cc03
11 changed files with 198 additions and 36 deletions

View File

@@ -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;

View File

@@ -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;
}