fix(api): remove unused v1 dto middleware logic

This commit is contained in:
yassinedorbozgithub 2024-10-13 21:11:34 +01:00
parent 88a1fee66c
commit 096f0c2e93
2 changed files with 2 additions and 30 deletions

View File

@ -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 {}

View File

@ -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();
}
}