refactor(server): logger (#9472)

This commit is contained in:
Jason Rasmussen
2024-05-14 08:48:49 -04:00
committed by GitHub
parent b1ca5455b5
commit 46868b3336
7 changed files with 46 additions and 43 deletions

View File

@@ -1,4 +1,4 @@
import { Body, Controller, Get, Next, Param, Post, Put, Query, Res } from '@nestjs/common';
import { Body, Controller, Get, Inject, Next, Param, Post, Put, Query, Res } from '@nestjs/common';
import { ApiTags } from '@nestjs/swagger';
import { NextFunction, Response } from 'express';
import { BulkIdResponseDto } from 'src/dtos/asset-ids.response.dto';
@@ -15,6 +15,7 @@ import {
PersonStatisticsResponseDto,
PersonUpdateDto,
} from 'src/dtos/person.dto';
import { ILoggerRepository } from 'src/interfaces/logger.interface';
import { Auth, Authenticated, FileResponse } from 'src/middleware/auth.guard';
import { PersonService } from 'src/services/person.service';
import { sendFile } from 'src/utils/file';
@@ -23,7 +24,10 @@ import { UUIDParamDto } from 'src/validation';
@ApiTags('Person')
@Controller('person')
export class PersonController {
constructor(private service: PersonService) {}
constructor(
private service: PersonService,
@Inject(ILoggerRepository) private logger: ILoggerRepository,
) {}
@Get()
@Authenticated()
@@ -74,7 +78,7 @@ export class PersonController {
@Auth() auth: AuthDto,
@Param() { id }: UUIDParamDto,
) {
await sendFile(res, next, () => this.service.getThumbnail(auth, id));
await sendFile(res, next, () => this.service.getThumbnail(auth, id), this.logger);
}
@Get(':id/assets')