refactor(server): immich file responses (#5641)

* refactor(server): immich file response

* chore: open api

* chore: tests

* chore: fix logger import

---------

Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
Jason Rasmussen
2023-12-12 09:58:25 -05:00
committed by GitHub
parent af7c4ae090
commit cbca69841a
25 changed files with 186 additions and 154 deletions

View File

@@ -3,6 +3,7 @@ import {
CreateUserDto as CreateDto,
CreateProfileImageDto,
CreateProfileImageResponseDto,
ImmichFileResponse,
UpdateUserDto as UpdateDto,
UserResponseDto,
UserService,
@@ -23,8 +24,8 @@ import {
UseInterceptors,
} from '@nestjs/common';
import { ApiBody, ApiConsumes, ApiTags } from '@nestjs/swagger';
import { AdminRoute, Auth, Authenticated } from '../app.guard';
import { UseValidation, asStreamableFile } from '../app.utils';
import { AdminRoute, Auth, Authenticated, FileResponse } from '../app.guard';
import { UseValidation } from '../app.utils';
import { FileUploadInterceptor, Route } from '../interceptors';
import { UUIDParamDto } from './dto/uuid-param.dto';
@@ -93,7 +94,8 @@ export class UserController {
@Get('profile-image/:id')
@Header('Cache-Control', 'private, no-cache, no-transform')
getProfileImage(@Param() { id }: UUIDParamDto): Promise<any> {
return this.service.getProfileImage(id).then(asStreamableFile);
@FileResponse()
getProfileImage(@Param() { id }: UUIDParamDto): Promise<ImmichFileResponse> {
return this.service.getProfileImage(id);
}
}