add: create supplier
This commit is contained in:
		| @@ -2,6 +2,7 @@ import { Entity, Column, PrimaryGeneratedColumn, ManyToOne } from 'typeorm'; | ||||
| import { Product } from './product.entity'; | ||||
| import { BaseModel } from '../../config/basemodel.entity'; | ||||
| import { productType } from '../../helper/enum-list'; | ||||
| import { User } from '../../users/entities/user.entity'; | ||||
|  | ||||
| @Entity() | ||||
| export class ProductHistoryPrice extends BaseModel { | ||||
| @@ -11,6 +12,9 @@ export class ProductHistoryPrice extends BaseModel { | ||||
|   @ManyToOne(() => Product, (product) => product.id) | ||||
|   product: Product; | ||||
|  | ||||
|   @ManyToOne(() => User, (user) => user.id) | ||||
|   user: User; | ||||
|  | ||||
|   @Column() | ||||
|   price: number; | ||||
|  | ||||
|   | ||||
| @@ -11,6 +11,7 @@ import { | ||||
| } from 'typeorm'; | ||||
| import { ProductSubCategories } from './product-sub-category.entity'; | ||||
| import { BaseModel } from '../../config/basemodel.entity'; | ||||
| import { Supplier } from '../../users/entities/supplier.entity'; | ||||
|  | ||||
| @Entity() | ||||
| export class Product extends BaseModel { | ||||
| @@ -43,4 +44,14 @@ export class Product extends BaseModel { | ||||
|     }, | ||||
|   ) | ||||
|   sub_categories: ProductSubCategories; | ||||
|  | ||||
|   @ManyToOne( | ||||
|     () => { | ||||
|       return Supplier; | ||||
|     }, | ||||
|     (partner) => { | ||||
|       return partner.id; | ||||
|     }, | ||||
|   ) | ||||
|   supplier: Supplier; | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user