From 72e7f313e8cf62903120aebe054b4d48af2ca2de Mon Sep 17 00:00:00 2001 From: Szymon Szafoni Date: Thu, 23 Nov 2023 21:19:22 +0100 Subject: [PATCH] split deletion module and deletion-api.module --- .../modules/deletion/deletion-api.module.ts | 45 +++++++++++++++++++ .../src/modules/deletion/deletion.module.ts | 38 ---------------- .../modules/server/admin-api.server.module.ts | 4 +- config/default.json | 3 ++ 4 files changed, 50 insertions(+), 40 deletions(-) create mode 100644 apps/server/src/modules/deletion/deletion-api.module.ts diff --git a/apps/server/src/modules/deletion/deletion-api.module.ts b/apps/server/src/modules/deletion/deletion-api.module.ts new file mode 100644 index 00000000000..3aeaaf7f01e --- /dev/null +++ b/apps/server/src/modules/deletion/deletion-api.module.ts @@ -0,0 +1,45 @@ +import { Module } from '@nestjs/common'; +import { DeletionModule } from '@modules/deletion'; +import { AccountModule } from '@modules/account'; +import { ClassModule } from '@modules/class'; +import { LearnroomModule } from '@modules/learnroom'; +import { FilesModule } from '@modules/files'; +import { PseudonymModule } from '@modules/pseudonym'; +import { LessonModule } from '@modules/lesson'; +import { TeamsModule } from '@modules/teams'; +import { UserModule } from '@modules/user'; +import { LoggerModule } from '@src/core/logger'; +import { AuthenticationModule } from '@modules/authentication'; +import { RocketChatUserModule } from '@modules/rocketchat-user'; +import { Configuration } from '@hpi-schul-cloud/commons'; +import { RocketChatModule } from '@modules/rocketchat'; +import { DeletionRequestsController } from './controller/deletion-requests.controller'; +import { DeletionExecutionsController } from './controller/deletion-executions.controller'; +import { DeletionRequestUc } from './uc'; + +@Module({ + imports: [ + DeletionModule, + AccountModule, + ClassModule, + LearnroomModule, + FilesModule, + LessonModule, + PseudonymModule, + TeamsModule, + UserModule, + LoggerModule, + AuthenticationModule, + RocketChatUserModule, + RocketChatModule.forRoot({ + uri: Configuration.get('ROCKET_CHAT_URI') as string, + adminId: Configuration.get('ROCKET_CHAT_ADMIN_ID') as string, + adminToken: Configuration.get('ROCKET_CHAT_ADMIN_TOKEN') as string, + adminUser: Configuration.get('ROCKET_CHAT_ADMIN_USER') as string, + adminPassword: Configuration.get('ROCKET_CHAT_ADMIN_PASSWORD') as string, + }), + ], + controllers: [DeletionRequestsController, DeletionExecutionsController], + providers: [DeletionRequestUc], +}) +export class DeletionApiModule {} diff --git a/apps/server/src/modules/deletion/deletion.module.ts b/apps/server/src/modules/deletion/deletion.module.ts index 960a6a57205..3be026b827c 100644 --- a/apps/server/src/modules/deletion/deletion.module.ts +++ b/apps/server/src/modules/deletion/deletion.module.ts @@ -1,54 +1,16 @@ import { Module } from '@nestjs/common'; import { ConfigService } from '@nestjs/config'; -import { Configuration } from '@hpi-schul-cloud/commons'; -import { LoggerModule } from '@src/core/logger'; -import { AuthenticationModule } from '@modules/authentication/authentication.module'; -import { AccountModule } from '@modules/account'; -import { ClassModule } from '@modules/class'; -import { LearnroomModule } from '@modules/learnroom'; -import { LessonModule } from '@modules/lesson'; -import { PseudonymModule } from '@modules/pseudonym'; -import { TeamsModule } from '@modules/teams'; -import { UserModule } from '@modules/user'; -import { RocketChatModule } from '@modules/rocketchat'; -import { FilesModule } from '@modules/files'; import { DeletionRequestService } from './services/deletion-request.service'; import { DeletionRequestRepo } from './repo/deletion-request.repo'; -import { DeletionRequestsController } from './controller/deletion-requests.controller'; -import { DeletionExecutionsController } from './controller/deletion-executions.controller'; import { XApiKeyConfig } from '../authentication/config/x-api-key.config'; -import { DeletionRequestUc } from './uc/deletion-request.uc'; import { DeletionLogService } from './services/deletion-log.service'; -import { RocketChatUserModule } from '../rocketchat-user'; import { DeletionLogRepo } from './repo'; @Module({ - imports: [ - LoggerModule, - AuthenticationModule, - AccountModule, - ClassModule, - LearnroomModule, - LessonModule, - PseudonymModule, - TeamsModule, - UserModule, - RocketChatModule.forRoot({ - uri: Configuration.get('ROCKET_CHAT_URI') as string, - adminId: Configuration.get('ROCKET_CHAT_ADMIN_ID') as string, - adminToken: Configuration.get('ROCKET_CHAT_ADMIN_TOKEN') as string, - adminUser: Configuration.get('ROCKET_CHAT_ADMIN_USER') as string, - adminPassword: Configuration.get('ROCKET_CHAT_ADMIN_PASSWORD') as string, - }), - RocketChatUserModule, - FilesModule, - ], - controllers: [DeletionRequestsController, DeletionExecutionsController], providers: [ DeletionRequestRepo, DeletionLogRepo, ConfigService, - DeletionRequestUc, DeletionLogService, DeletionRequestService, ], diff --git a/apps/server/src/modules/server/admin-api.server.module.ts b/apps/server/src/modules/server/admin-api.server.module.ts index bacab1b0795..fc11b5b772b 100644 --- a/apps/server/src/modules/server/admin-api.server.module.ts +++ b/apps/server/src/modules/server/admin-api.server.module.ts @@ -10,12 +10,12 @@ import { FileEntity } from '@modules/files/entity'; import { FileRecord } from '@modules/files-storage/entity'; import { RedisClient } from 'redis'; import { REDIS_CLIENT, RedisModule } from '@src/infra/redis'; -import { DeletionModule } from '../deletion'; import { defaultMikroOrmOptions, setupSessions } from './server.module'; import { serverConfig } from './server.config'; import { AdminApiServerController } from './controller'; +import { DeletionApiModule } from '../deletion/deletion-api.module'; -const serverModules = [ConfigModule.forRoot(createConfigModuleOptions(serverConfig)), DeletionModule]; +const serverModules = [ConfigModule.forRoot(createConfigModuleOptions(serverConfig)), DeletionApiModule]; @Module({ imports: [ diff --git a/config/default.json b/config/default.json index 7dd1802a037..5306bba17c2 100644 --- a/config/default.json +++ b/config/default.json @@ -41,5 +41,8 @@ }, "CTL_TOOLS": { "EXTERNAL_TOOL_MAX_LOGO_SIZE_IN_BYTES": 300000 + }, + "ADMIN_API": { + "ALLOWED_API_KEYS": "1ab2c3d4e5f61ab2c3d4e5f6dasda" } }