add: member by superrior
This commit is contained in:
		| @@ -2,17 +2,15 @@ import { | ||||
|   Entity, | ||||
|   Column, | ||||
|   PrimaryGeneratedColumn, | ||||
|   UpdateDateColumn, | ||||
|   DeleteDateColumn, | ||||
|   VersionColumn, | ||||
|   CreateDateColumn, | ||||
|   ManyToOne, | ||||
|   OneToMany, | ||||
| } from 'typeorm'; | ||||
| import { ProductCategories } from './product-category.entity'; | ||||
| import { BaseModel } from '../../config/basemodel.entity'; | ||||
| import { Product } from './product.entity'; | ||||
|  | ||||
| @Entity() | ||||
| export class ProductSubCategories extends BaseModel{ | ||||
| export class ProductSubCategories extends BaseModel { | ||||
|   @PrimaryGeneratedColumn('uuid') | ||||
|   id: string; | ||||
|  | ||||
| @@ -21,4 +19,7 @@ export class ProductSubCategories extends BaseModel{ | ||||
|  | ||||
|   @ManyToOne(() => ProductCategories, (categories) => categories.subCategories) | ||||
|   category: ProductCategories; | ||||
|  | ||||
|   @OneToMany(() => Product, (product) => product.subCategories) | ||||
|   product: Product; | ||||
| } | ||||
|   | ||||
| @@ -13,7 +13,7 @@ import { ProductSubCategories } from './product-sub-category.entity'; | ||||
| import { BaseModel } from '../../config/basemodel.entity'; | ||||
|  | ||||
| @Entity() | ||||
| export class Product extends BaseModel{ | ||||
| export class Product extends BaseModel { | ||||
|   @PrimaryGeneratedColumn('uuid') | ||||
|   id: string; | ||||
|  | ||||
| @@ -30,13 +30,17 @@ export class Product extends BaseModel{ | ||||
|   price: number; | ||||
|  | ||||
|   @Column({ | ||||
|     nullable:true | ||||
|     nullable: true, | ||||
|   }) | ||||
|   basePrice: number; | ||||
|  | ||||
|   @ManyToOne( | ||||
|     () => ProductSubCategories, | ||||
|     (subCategories) => subCategories.category, | ||||
|     () => { | ||||
|       return ProductSubCategories; | ||||
|     }, | ||||
|     (subCategories) => { | ||||
|       return subCategories.product; | ||||
|     }, | ||||
|   ) | ||||
|   subCategories: ProductSubCategories; | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user