From 096f0c2e93c061b2f1a7c014b6418b9ea48c6508 Mon Sep 17 00:00:00 2001 From: yassinedorbozgithub Date: Sun, 13 Oct 2024 21:11:34 +0100 Subject: [PATCH] fix(api): remove unused v1 dto middleware logic --- api/src/app.module.ts | 11 ++-------- api/src/middlewares/dto.update.middleware.ts | 21 -------------------- 2 files changed, 2 insertions(+), 30 deletions(-) delete mode 100644 api/src/middlewares/dto.update.middleware.ts diff --git a/api/src/app.module.ts b/api/src/app.module.ts index 3690b85d..20b8cb60 100644 --- a/api/src/app.module.ts +++ b/api/src/app.module.ts @@ -9,7 +9,7 @@ import path from 'path'; import { CacheModule } from '@nestjs/cache-manager'; -import { MiddlewareConsumer, Module, RequestMethod } from '@nestjs/common'; +import { Module } from '@nestjs/common'; import { APP_GUARD } from '@nestjs/core'; import { EventEmitterModule } from '@nestjs/event-emitter'; import { MongooseModule } from '@nestjs/mongoose'; @@ -33,7 +33,6 @@ import { CmsModule } from './cms/cms.module'; import { config } from './config'; import { I18nModule } from './i18n/i18n.module'; import { LoggerModule } from './logger/logger.module'; -import { DtoUpdateMiddleware } from './middlewares/dto.update.middleware'; import { NlpModule } from './nlp/nlp.module'; import { PluginsModule } from './plugins/plugins.module'; import { SettingModule } from './setting/setting.module'; @@ -133,10 +132,4 @@ const i18nOptions: I18nOptions = { AppService, ], }) -export class AppModule { - configure(consumer: MiddlewareConsumer) { - consumer - .apply(DtoUpdateMiddleware) - .forRoutes({ path: '*', method: RequestMethod.PATCH }); - } -} +export class AppModule {} diff --git a/api/src/middlewares/dto.update.middleware.ts b/api/src/middlewares/dto.update.middleware.ts deleted file mode 100644 index 0875709c..00000000 --- a/api/src/middlewares/dto.update.middleware.ts +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright © 2024 Hexastack. All rights reserved. - * - * Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms: - * 1. The name "Hexabot" is a trademark of Hexastack. You may not use this name in derivative works without express written permission. - * 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file). - */ - -import { Injectable, NestMiddleware } from '@nestjs/common'; -import { Request, Response, NextFunction } from 'express'; - -@Injectable() -export class DtoUpdateMiddleware implements NestMiddleware { - use(req: Request, _res: Response, next: NextFunction) { - delete req.body?.createdAt; - delete req.body?.updatedAt; - delete req.body?.id; - - next(); - } -}