UNPKG

@tomei/product

Version:

NestJS package for product module

80 lines (67 loc) 1.35 kB
import { BelongsTo, Column, CreatedAt, DataType, ForeignKey, Model, Table, UpdatedAt, } from 'sequelize-typescript'; import { StoreModel } from './store.entity'; import { ProductModel } from './product.entity'; @Table({ tableName: 'store_Product' }) export class StoreProductModel extends Model { @Column({ type: DataType.STRING, allowNull: false, primaryKey: true, }) StoreProductId: string; @ForeignKey(() => ProductModel) @Column({ allowNull: false, type: DataType.STRING, }) ProductId: string; @ForeignKey(() => StoreModel) @Column({ allowNull: false, type: DataType.STRING, }) StoreId: string; @Column({ type: DataType.ENUM('Active', 'Removed'), defaultValue: 'Active', }) Status: string; @Column({ allowNull: false, type: DataType.STRING, }) PriceFormula: string; @Column({ allowNull: false, type: DataType.STRING, }) AddedById: string; @CreatedAt AddedAt: Date; @Column({ allowNull: true, type: DataType.STRING, }) RemovedById: string; @Column({ allowNull: true, type: DataType.DATE, }) @UpdatedAt RemovedAt: Date; @BelongsTo(() => ProductModel) Product: ProductModel; @BelongsTo(() => StoreModel) Store: StoreModel; @BelongsTo(() => ProductModel) ProductVariant: ProductModel; }