main
Some checks failed
Backend Deploy 🚀 / build-and-deploy (push) Has been cancelled

This commit is contained in:
Harun CAN
2026-03-17 13:16:12 +03:00
parent 1a6b00478f
commit e0d41d0386
37 changed files with 1326 additions and 750 deletions

View File

@@ -1,4 +1,4 @@
import { Module } from '@nestjs/common';
import { Module, Logger as NestLogger } from '@nestjs/common';
import { ConfigModule, ConfigService } from '@nestjs/config';
import { APP_FILTER, APP_GUARD, APP_INTERCEPTOR } from '@nestjs/core';
import { ThrottlerModule, ThrottlerGuard } from '@nestjs/throttler';
@@ -41,6 +41,7 @@ import { AdminModule } from './modules/admin/admin.module';
import { HealthModule } from './modules/health/health.module';
import { GeminiModule } from './modules/gemini/gemini.module';
import { CmsModule } from './modules/cms/cms.module';
import { MailModule } from './modules/mail/mail.module';
// Guards
import {
@@ -71,7 +72,7 @@ import {
LoggerModule.forRootAsync({
imports: [ConfigModule],
inject: [ConfigService],
useFactory: async (configService: ConfigService) => {
useFactory: (configService: ConfigService) => {
return {
pinoHttp: {
level: configService.get('app.isDevelopment') ? 'debug' : 'info',
@@ -121,6 +122,7 @@ import {
isGlobal: true,
imports: [ConfigModule],
useFactory: async (configService: ConfigService) => {
const logger = new NestLogger('CacheModule');
const useRedis = configService.get('REDIS_ENABLED', 'false') === 'true';
if (useRedis) {
@@ -132,18 +134,18 @@ import {
},
ttl: 60 * 1000, // 1 minute default
});
console.log('✅ Redis cache connected');
logger.log('✅ Redis cache connected');
return {
store: store as unknown as any,
ttl: 60 * 1000,
};
} catch {
console.warn('⚠️ Redis connection failed, using in-memory cache');
logger.warn('⚠️ Redis connection failed, using in-memory cache');
}
}
// Fallback to in-memory cache
console.log('📦 Using in-memory cache');
logger.log('📦 Using in-memory cache');
return {
ttl: 60 * 1000,
};
@@ -166,6 +168,9 @@ import {
// CMS Module
CmsModule,
// Mail Module
MailModule,
// Serve uploaded files
ServeStaticModule.forRoot({
rootPath: path.join(__dirname, '..', 'uploads'),
@@ -210,4 +215,10 @@ import {
},
],
})
export class AppModule { }
export class AppModule {
private readonly logger = new NestLogger(AppModule.name);
constructor() {
this.logger.log('AppModule initialized');
}
}