UNPKG

@tomei/product

Version:

NestJS package for product module

57 lines (44 loc) 1.37 kB
import { Table, Column, Model, DataType, CreatedAt, UpdatedAt, BelongsToMany, HasMany, } from 'sequelize-typescript'; import { ProductModel } from './product.entity'; import { ProductCategoriesModel } from './product-category.entity'; import { SettingsPlatformCategoryMappingModel } from './settings-platform-category-mapping.entity'; import { StatusEnum } from '../components/group-product/enum/status.enum'; @Table({ tableName: 'product_Category' }) export class SettingsCategoryModel extends Model { @Column({ primaryKey: true }) Code: string; @Column({ allowNull: false, unique: true, type: DataType.STRING(100) }) Name: string; @Column({ allowNull: false, type: DataType.STRING(1000) }) Description: string; @Column({ type: DataType.ENUM('Active', 'Deactivated'), defaultValue: 'Active', }) Status: StatusEnum; @Column({ allowNull: true }) ParentCode: string; @Column({ allowNull: true }) CodePath: string; @Column({ allowNull: false }) CreatedById: string; @CreatedAt CreatedAt: Date; @UpdatedAt UpdatedAt: Date; @Column({ allowNull: false }) UpdatedById: string; @BelongsToMany(() => ProductModel, () => ProductCategoriesModel) Products: ProductModel[]; @HasMany(() => SettingsPlatformCategoryMappingModel) PlatformCategoryMapping: SettingsPlatformCategoryMappingModel[]; }