47 lines
765 B
TypeScript
47 lines
765 B
TypeScript
import {
|
|
Entity,
|
|
Column,
|
|
PrimaryGeneratedColumn,
|
|
UpdateDateColumn,
|
|
DeleteDateColumn,
|
|
VersionColumn,
|
|
CreateDateColumn,
|
|
OneToMany,
|
|
ManyToOne,
|
|
} from 'typeorm';
|
|
import { ProductSubCategories } from './product-sub-category.entity';
|
|
import { BaseModel } from '../../config/basemodel.entity';
|
|
|
|
@Entity()
|
|
export class Product extends BaseModel {
|
|
@PrimaryGeneratedColumn('uuid')
|
|
id: string;
|
|
|
|
@Column()
|
|
name: string;
|
|
|
|
@Column()
|
|
code: string;
|
|
|
|
@Column()
|
|
status: string;
|
|
|
|
@Column()
|
|
price: number;
|
|
|
|
@Column({
|
|
nullable: true,
|
|
})
|
|
basePrice: number;
|
|
|
|
@ManyToOne(
|
|
() => {
|
|
return ProductSubCategories;
|
|
},
|
|
(subCategories) => {
|
|
return subCategories.product;
|
|
},
|
|
)
|
|
subCategories: ProductSubCategories;
|
|
}
|