mirror of
https://github.com/immich-app/immich.git
synced 2024-11-28 09:33:27 +02:00
chore(server): remove unused code (#1513)
* chore(server): remove unused code * chore(server): unused imports
This commit is contained in:
parent
3a940711eb
commit
7aab84f2d9
@ -1,14 +1,10 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { JobService } from './job.service';
|
||||
import { JobController } from './job.controller';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
import { ExifEntity } from '@app/infra';
|
||||
import { TagModule } from '../tag/tag.module';
|
||||
import { AssetModule } from '../asset/asset.module';
|
||||
import { StorageModule } from '@app/storage';
|
||||
|
||||
@Module({
|
||||
imports: [TypeOrmModule.forFeature([ExifEntity]), TagModule, AssetModule, StorageModule],
|
||||
imports: [AssetModule],
|
||||
controllers: [JobController],
|
||||
providers: [JobService],
|
||||
})
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { immichAppConfig } from '@app/common/config';
|
||||
import { MiddlewareConsumer, Module, NestModule } from '@nestjs/common';
|
||||
import { Module } from '@nestjs/common';
|
||||
import { AssetModule } from './api-v1/asset/asset.module';
|
||||
import { ConfigModule } from '@nestjs/config';
|
||||
import { ServerInfoModule } from './api-v1/server-info/server-info.module';
|
||||
@ -61,12 +61,4 @@ import { AuthGuard } from './middlewares/auth.guard';
|
||||
],
|
||||
providers: [{ provide: APP_GUARD, useExisting: AuthGuard }, AuthGuard],
|
||||
})
|
||||
export class AppModule implements NestModule {
|
||||
// TODO: check if consumer is needed or remove
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
configure(consumer: MiddlewareConsumer): void {
|
||||
if (process.env.NODE_ENV == 'development') {
|
||||
// consumer.apply(AppLoggerMiddleware).forRoutes('*');
|
||||
}
|
||||
}
|
||||
}
|
||||
export class AppModule {}
|
||||
|
@ -1,22 +0,0 @@
|
||||
import { Injectable, NestMiddleware, Logger } from '@nestjs/common';
|
||||
|
||||
import { Request, Response, NextFunction } from 'express';
|
||||
|
||||
@Injectable()
|
||||
export class AppLoggerMiddleware implements NestMiddleware {
|
||||
private logger = new Logger('HTTP');
|
||||
|
||||
use(request: Request, response: Response, next: NextFunction): void {
|
||||
const { ip, method, baseUrl } = request;
|
||||
const userAgent = request.get('user-agent') || '';
|
||||
|
||||
response.on('close', () => {
|
||||
const { statusCode } = response;
|
||||
const contentLength = response.get('content-length');
|
||||
|
||||
this.logger.log(`${method} ${baseUrl} ${statusCode} ${contentLength} - ${userAgent} ${ip}`);
|
||||
});
|
||||
|
||||
next();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user