mirror of
https://github.com/hexastack/hexabot
synced 2024-11-24 13:05:15 +00:00
fix(api): remove unused v1 dto middleware logic
This commit is contained in:
parent
88a1fee66c
commit
096f0c2e93
@ -9,7 +9,7 @@
|
|||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
|
||||||
import { CacheModule } from '@nestjs/cache-manager';
|
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 { APP_GUARD } from '@nestjs/core';
|
||||||
import { EventEmitterModule } from '@nestjs/event-emitter';
|
import { EventEmitterModule } from '@nestjs/event-emitter';
|
||||||
import { MongooseModule } from '@nestjs/mongoose';
|
import { MongooseModule } from '@nestjs/mongoose';
|
||||||
@ -33,7 +33,6 @@ import { CmsModule } from './cms/cms.module';
|
|||||||
import { config } from './config';
|
import { config } from './config';
|
||||||
import { I18nModule } from './i18n/i18n.module';
|
import { I18nModule } from './i18n/i18n.module';
|
||||||
import { LoggerModule } from './logger/logger.module';
|
import { LoggerModule } from './logger/logger.module';
|
||||||
import { DtoUpdateMiddleware } from './middlewares/dto.update.middleware';
|
|
||||||
import { NlpModule } from './nlp/nlp.module';
|
import { NlpModule } from './nlp/nlp.module';
|
||||||
import { PluginsModule } from './plugins/plugins.module';
|
import { PluginsModule } from './plugins/plugins.module';
|
||||||
import { SettingModule } from './setting/setting.module';
|
import { SettingModule } from './setting/setting.module';
|
||||||
@ -133,10 +132,4 @@ const i18nOptions: I18nOptions = {
|
|||||||
AppService,
|
AppService,
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class AppModule {
|
export class AppModule {}
|
||||||
configure(consumer: MiddlewareConsumer) {
|
|
||||||
consumer
|
|
||||||
.apply(DtoUpdateMiddleware)
|
|
||||||
.forRoutes({ path: '*', method: RequestMethod.PATCH });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user