Update src/app.service.ts

This commit is contained in:
Codevice Solution Pvt Ltd 2025-08-14 08:08:24 +00:00
parent 1b7e5569bc
commit 81ff748795

View File

@ -18,7 +18,7 @@ export class AppService {
return 'Hello World!'; return 'Hello World!';
} }
initializeSequelize() { async initializeSequelize() {
this.getModels(); this.getModels();
const dbConfig = this.configService.getDbConfig(); const dbConfig = this.configService.getDbConfig();
if (this.modelFilePaths.length > 0) { if (this.modelFilePaths.length > 0) {
@ -29,13 +29,13 @@ export class AppService {
dialect: 'postgres', dialect: 'postgres',
username: "postgres", username: "postgres",
password: "FAdDoCwhmi3BvkK4pgEGDc7EspmDtHYV4y93748Xz6VysJKPdlsaU3L9N9k7OD9t", password: "FAdDoCwhmi3BvkK4pgEGDc7EspmDtHYV4y93748Xz6VysJKPdlsaU3L9N9k7OD9t",
autoLoadModels: true, // Auto-load model files
synchronize: true,
models: this.modelFilePaths, models: this.modelFilePaths,
modelMatch: (filename, member) => { modelMatch: (filename, member) => {
return filename.substring(0, filename.indexOf('.entity')) === member.toLowerCase(); return filename.substring(0, filename.indexOf('.entity')) === member.toLowerCase();
}, },
}); });
await this.commonService.sequelize.sync({ alter: true });
Utility.sequelize = this.commonService.sequelize; Utility.sequelize = this.commonService.sequelize;
} }
const fileConfig = this.configService.initializeFileSystem(); const fileConfig = this.configService.initializeFileSystem();