fix(version-service): use DatabaseModule.forRoot() for correct build path
The entrypoint.sh expects dist/services/${SERVICE_NAME}/src/main, but
nest build with inline TypeORM config produces dist/main directly.
Using DatabaseModule from @it0/database forces tsc to emit the nested
path structure (since it references shared packages), matching the
entrypoint path convention used by all other services.
Also gains SnakeNamingStrategy and autoLoadEntities from the shared module.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
f6dffe02c5
commit
260195db50
|
|
@ -1,6 +1,7 @@
|
|||
import { Module } from '@nestjs/common';
|
||||
import { ConfigModule, ConfigService } from '@nestjs/config';
|
||||
import { ConfigModule } from '@nestjs/config';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
import { DatabaseModule } from '@it0/database';
|
||||
import { AppVersion } from './domain/entities/app-version.entity';
|
||||
import { AppVersionRepository } from './infrastructure/repositories/app-version.repository';
|
||||
import { VersionController } from './interfaces/rest/controllers/version.controller';
|
||||
|
|
@ -8,20 +9,7 @@ import { VersionController } from './interfaces/rest/controllers/version.control
|
|||
@Module({
|
||||
imports: [
|
||||
ConfigModule.forRoot({ isGlobal: true }),
|
||||
TypeOrmModule.forRootAsync({
|
||||
imports: [ConfigModule],
|
||||
inject: [ConfigService],
|
||||
useFactory: (config: ConfigService) => ({
|
||||
type: 'postgres' as const,
|
||||
host: config.get<string>('DB_HOST', 'localhost'),
|
||||
port: config.get<number>('DB_PORT', 5432),
|
||||
username: config.get<string>('DB_USERNAME', 'it0'),
|
||||
password: config.get<string>('DB_PASSWORD', 'it0_dev'),
|
||||
database: config.get<string>('DB_DATABASE', 'it0'),
|
||||
entities: [AppVersion],
|
||||
synchronize: true,
|
||||
}),
|
||||
}),
|
||||
DatabaseModule.forRoot(),
|
||||
TypeOrmModule.forFeature([AppVersion]),
|
||||
],
|
||||
controllers: [VersionController],
|
||||
|
|
|
|||
Loading…
Reference in New Issue