@tomei/product
Version:
NestJS package for product module
83 lines (77 loc) • 2.84 kB
text/typescript
import { Sequelize, SequelizeOptions } from 'sequelize-typescript';
import { ProductBrandModel } from './entities/product-brand.entity';
import { ProductCategoriesModel } from './entities/product-category.entity';
import { ProductCertificateModel } from './entities/product-certificate.entity';
import { ProductCollectionsModel } from './entities/product-collection.entity';
import { ProductCustomizeOptionModel } from './entities/product-customize-option.entity';
import { ProductGroupModel } from './entities/product-group.entity';
import { ProductJewelleryModel } from './entities/product-jewellery.entity';
import { ProductMaterialModel } from './entities/product-material.entity';
import { ProductTagModel } from './entities/product-tag.entity';
import { ProductWithInventoryModel } from './entities/product-with-inventory.entity';
import { ProductModel } from './entities/product.entity';
import { SettingsCategoryModel } from './entities/settings-category.entity';
import { SettingsCollectionModel } from './entities/settings-collection.entity';
import { SettingsGroupModel } from './entities/settings-group.entity';
import { SettingsPlatformCategoryMappingModel } from './entities/settings-platform-category-mapping.entity';
import { StoreProductModel } from './entities/store-product.entity';
import { StoreModel } from './entities/store.entity';
import {
StockCost,
StockCustomizeOption,
StockProfileModel,
StockInventoryModel,
StockInventoryGroup,
StockLocation,
StockMaterial,
StockMaterialInfo,
StockPrice,
StockProfileMaterial,
StockSupplierPart,
StockTag,
StockGroupModel,
} from '@tomei/stock';
import { ProductVariantModel } from './entities/product-variant.entity';
import { ProductVariantWithInventoryModel } from './entities/product-variant-with-inventory.entity';
let sequelize: Sequelize;
function init(sequelizeOptions: SequelizeOptions) {
sequelize = new Sequelize(sequelizeOptions);
sequelize.addModels([
ProductBrandModel,
ProductCategoriesModel,
ProductCertificateModel,
ProductCollectionsModel,
ProductCustomizeOptionModel,
ProductGroupModel,
ProductJewelleryModel,
ProductMaterialModel,
ProductTagModel,
ProductWithInventoryModel,
ProductModel,
SettingsCategoryModel,
SettingsCollectionModel,
SettingsGroupModel,
SettingsPlatformCategoryMappingModel,
StoreProductModel,
StoreModel,
StockCost,
StockCustomizeOption,
StockProfileModel,
StockGroupModel,
StockInventoryModel,
StockInventoryGroup,
StockLocation,
StockMaterial,
StockMaterialInfo,
StockPrice,
StockProfileMaterial,
StockSupplierPart,
StockTag,
ProductVariantModel,
ProductVariantWithInventoryModel,
]);
}
function getConnection() {
return sequelize;
}
export { init, getConnection };