UNPKG

@tomei/product

Version:

NestJS package for product module

151 lines (118 loc) 4.03 kB
import { Column, CreatedAt, DataType, HasMany, Table, UpdatedAt, Model, BelongsToMany, HasOne, } from 'sequelize-typescript'; import { ProductCertificateModel } from './product-certificate.entity'; import { ProductTagModel } from './product-tag.entity'; import { ProductBrandModel } from './product-brand.entity'; import { ProductCustomizeOptionModel } from './product-customize-option.entity'; import { ProductMaterialModel } from './product-material.entity'; import { SettingsCollectionModel } from './settings-collection.entity'; import { ProductCollectionsModel } from './product-collection.entity'; import { SettingsCategoryModel } from './settings-category.entity'; import { ProductCategoriesModel } from './product-category.entity'; import { StoreModel } from './store.entity'; import { StoreProductModel } from './store-product.entity'; import { SettingsGroupModel } from './settings-group.entity'; import { ProductGroupModel } from './product-group.entity'; import { ProductWithInventoryModel } from './product-with-inventory.entity'; @Table({ tableName: 'product_Product' }) export class ProductModel extends Model { @Column({ type: DataType.STRING, allowNull: false, primaryKey: true, }) ProductId: string; @Column({ allowNull: false, unique: true, type: DataType.TEXT + ' CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci', }) Name: string; @Column({ allowNull: true, type: DataType.TEXT + ' CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci', }) Description: string; @Column({ allowNull: false, type: DataType.INTEGER }) VariantLevels: number; @Column({ allowNull: true, type: DataType.STRING(30) }) VariantTypeLevel1: string; @Column({ allowNull: true, type: DataType.STRING(30) }) VariantTypeLevel2: string; @Column({ allowNull: true, type: DataType.STRING(30) }) VariantTypeLevel3: string; @Column({ allowNull: false, type: DataType.CHAR(1), defaultValue: 'N' }) UpdatedSSYN: string; @Column({ allowNull: false, unique: true, type: DataType.STRING(30) }) SKU: string; @Column({ allowNull: true, type: DataType.STRING(30) }) PreviousSKU: string; @Column({ allowNull: false, type: DataType.STRING(30), }) Type: string; @CreatedAt CreatedAt: Date; @Column({ allowNull: false }) CreatedById: string; @UpdatedAt UpdatedAt: Date; @Column({ allowNull: false }) UpdatedById: string; @Column({ allowNull: true, type: DataType.STRING(5000) }) Remark: string; @Column({ allowNull: true, type: DataType.STRING(1) }) IsTaxableYN: string; @Column({ allowNull: true, type: DataType.STRING(10) }) TaxCode: string; @Column({ allowNull: true, type: DataType.STRING(1) }) IsPriceInclusiveTaxYN: string; @Column({ type: DataType.ENUM('Active', 'Inactive', 'Deleted', 'Discontinued'), defaultValue: 'Active', }) Status: string; @Column({ type: DataType.ENUM('Y', 'N'), defaultValue: 'N', }) VerifiedYN: string; @Column({ type: DataType.STRING, }) VerifiedById: string; @Column({ type: DataType.DATE, }) VerifiedAt: Date; @HasMany(() => ProductCertificateModel) Certificates: ProductCertificateModel[]; @HasMany(() => ProductTagModel) Tags: ProductTagModel[]; @HasMany(() => ProductBrandModel) Brand: ProductBrandModel[]; @HasMany(() => ProductCustomizeOptionModel) CustomizeOptions: ProductCustomizeOptionModel[]; @HasMany(() => ProductMaterialModel) Materials: ProductMaterialModel[]; @BelongsToMany(() => SettingsCollectionModel, () => ProductCollectionsModel) Collections: SettingsCollectionModel[]; @BelongsToMany(() => SettingsCategoryModel, () => ProductCategoriesModel) Categories: SettingsCategoryModel[]; @BelongsToMany(() => StoreModel, () => StoreProductModel) Stores: StoreModel[]; @BelongsToMany(() => SettingsGroupModel, () => ProductGroupModel) Groups: SettingsGroupModel[]; @HasOne(() => ProductWithInventoryModel) ProductWithInventory: ProductWithInventoryModel[]; }