mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-25 18:26:05 +08:00
refactor(server): folder structure (#5573)
This commit is contained in:
@@ -2,16 +2,16 @@ import { DynamicModule, Module, Type } from '@nestjs/common';
|
||||
import { APP_INTERCEPTOR } from '@nestjs/core';
|
||||
|
||||
import { AppController } from './app.controller';
|
||||
import { CacheInterceptor, CacheModule } from './cache';
|
||||
import { RedisModule } from './cache/redis';
|
||||
import { ConfigModule, SERVER_FLAVOR } from './config';
|
||||
import { EventModule } from './event';
|
||||
import { MetricsModule } from './metrics';
|
||||
import { CacheInterceptor, CacheModule } from './fundamentals/cache';
|
||||
import { ConfigModule } from './fundamentals/config';
|
||||
import { EventModule } from './fundamentals/event';
|
||||
import { MailModule } from './fundamentals/mailer';
|
||||
import { MetricsModule } from './fundamentals/metrics';
|
||||
import { PrismaModule } from './fundamentals/prisma';
|
||||
import { SessionModule } from './fundamentals/session';
|
||||
import { RateLimiterModule } from './fundamentals/throttler';
|
||||
import { BusinessModules } from './modules';
|
||||
import { AuthModule } from './modules/auth';
|
||||
import { PrismaModule } from './prisma';
|
||||
import { SessionModule } from './session';
|
||||
import { RateLimiterModule } from './throttler';
|
||||
|
||||
export const FunctionalityModules: Array<Type | DynamicModule> = [
|
||||
ConfigModule.forRoot(),
|
||||
@@ -22,13 +22,9 @@ export const FunctionalityModules: Array<Type | DynamicModule> = [
|
||||
SessionModule,
|
||||
RateLimiterModule,
|
||||
AuthModule,
|
||||
MailModule,
|
||||
];
|
||||
|
||||
// better module registration logic
|
||||
if (AFFiNE.redis.enabled) {
|
||||
FunctionalityModules.push(RedisModule);
|
||||
}
|
||||
|
||||
@Module({
|
||||
providers: [
|
||||
{
|
||||
@@ -37,6 +33,6 @@ if (AFFiNE.redis.enabled) {
|
||||
},
|
||||
],
|
||||
imports: [...FunctionalityModules, ...BusinessModules],
|
||||
controllers: SERVER_FLAVOR === 'selfhosted' ? [] : [AppController],
|
||||
controllers: [AppController],
|
||||
})
|
||||
export class AppModule {}
|
||||
|
||||
Reference in New Issue
Block a user