UNPKG

@tomei/product

Version:

NestJS package for product module

49 lines (41 loc) 946 B
import { Column, DataType, ForeignKey, Model, Table, CreatedAt, UpdatedAt, BelongsTo, } from 'sequelize-typescript'; import { ProductModel } from './product.entity'; import { SettingsCollectionModel } from './settings-collection.entity'; @Table({ tableName: 'product_ProductCollection' }) export class ProductCollectionsModel extends Model { @Column({ type: DataType.STRING, allowNull: false, primaryKey: true, }) ProductCollectionId: string; @ForeignKey(() => ProductModel) @Column({ allowNull: false, type: DataType.STRING, }) ProductId: string; @ForeignKey(() => SettingsCollectionModel) @Column({ allowNull: false, type: DataType.STRING, }) Code: string; @BelongsTo(() => ProductModel) Product: ProductModel; @BelongsTo(() => SettingsCollectionModel) ProductCollection: SettingsCollectionModel; @CreatedAt CreatedAt: Date; @UpdatedAt UpdatedAt: Date; }