add: create supplier

This commit is contained in:
ilham
2021-12-11 23:45:03 +07:00
parent d332935e85
commit 14a00988d9
18 changed files with 267 additions and 45 deletions

View File

@@ -18,4 +18,7 @@ export class CreateProductDto {
@IsUUID()
subCategoriesId: string;
@IsUUID()
supplierId: string;
}

View File

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

View File

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