- Création entité DocumentLegal - Création entité AcceptationDocument - Création DocumentsLegauxService avec méthodes: * getDocumentsActifs() * uploadNouvelleVersion() (avec hash SHA-256) * activerVersion() (transaction) * listerVersions() * telechargerDocument() * verifierIntegrite() * enregistrerAcceptation() * getAcceptationsUtilisateur() - Création DocumentsLegauxModule - Intégration dans AppModule - Ajout dépendances multer + @types/multer Réf: docs/22_DOCUMENTS-LEGAUX.md
72 lines
2.3 KiB
TypeScript
72 lines
2.3 KiB
TypeScript
import { Module } from '@nestjs/common';
|
|
import { ConfigModule, ConfigService } from '@nestjs/config';
|
|
import { AppController } from './app.controller';
|
|
import { AppService } from './app.service';
|
|
import appConfig from './config/app.config';
|
|
import databaseConfig from './config/database.config';
|
|
import jwtConfig from './config/jwt.config';
|
|
import { configValidationSchema } from './config/validation.schema';
|
|
import { UserModule } from './routes/user/user.module';
|
|
import { TypeOrmModule } from '@nestjs/typeorm';
|
|
import { APP_FILTER } from '@nestjs/core';
|
|
import { ParentsModule } from './routes/parents/parents.module';
|
|
import { AuthModule } from './routes/auth/auth.module';
|
|
import { SentryGlobalFilter } from '@sentry/nestjs/setup';
|
|
import { AllExceptionsFilter } from './common/filters/all_exceptions.filters';
|
|
import { EnfantsModule } from './routes/enfants/enfants.module';
|
|
import { AppConfigModule } from './modules/config/config.module';
|
|
import { DocumentsLegauxModule } from './modules/documents-legaux';
|
|
|
|
@Module({
|
|
imports: [
|
|
ConfigModule.forRoot({
|
|
// Gestion dynamique des fichiers .env
|
|
envFilePath: [`.env.${process.env.NODE_ENV || 'development'}`, '.env'],
|
|
// envFilePath: '.env',
|
|
|
|
// Chargement de configurations typées
|
|
load: [appConfig, databaseConfig, jwtConfig],
|
|
|
|
isGlobal: true,
|
|
validationSchema: configValidationSchema,
|
|
}),
|
|
TypeOrmModule.forRootAsync({
|
|
imports: [ConfigModule,
|
|
],
|
|
inject: [ConfigService],
|
|
useFactory: (config: ConfigService) => ({
|
|
type: 'postgres',
|
|
host: config.get('database.host'),
|
|
port: config.get<number>('database.port'),
|
|
username: config.get('database.username'),
|
|
password: config.get('database.password'),
|
|
database: config.get('database.database'),
|
|
entities: [__dirname + '/**/*.entity{.ts,.js}'],
|
|
synchronize: false,
|
|
migrations: [__dirname + '/migrations/**/*{.ts,.js}'],
|
|
logging: true,
|
|
}),
|
|
}),
|
|
UserModule,
|
|
ParentsModule,
|
|
EnfantsModule,
|
|
AuthModule,
|
|
AppConfigModule,
|
|
DocumentsLegauxModule,
|
|
],
|
|
controllers: [AppController],
|
|
providers: [
|
|
AppService,
|
|
{
|
|
provide: APP_FILTER,
|
|
useClass: SentryGlobalFilter
|
|
},
|
|
{
|
|
provide: APP_FILTER,
|
|
useClass: AllExceptionsFilter,
|
|
}
|
|
|
|
],
|
|
})
|
|
export class AppModule { }
|