From 3976412a0df622c9387e307cc783876863586761 Mon Sep 17 00:00:00 2001 From: msjang4 Date: Fri, 1 Dec 2023 22:07:20 +0900 Subject: [PATCH] =?UTF-8?q?feat=20:=20=ED=94=84=EB=A1=9C=ED=95=84=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=20Presigned=20Url=EC=8B=9C=20UUID=20?= =?UTF-8?q?=EB=8C=80=EC=8B=A0=20JWT=EB=A1=9C=20=EA=B2=80=EC=A6=9D-?= =?UTF-8?q?=EB=B3=84=EC=A0=90=200=EC=A0=90=EA=B9=8C=EC=A7=80=20=EB=93=B1?= =?UTF-8?q?=EB=A1=9D=EA=B0=80=EB=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/profile-presigned-url-request.dto.ts | 8 -------- server/src/presigned-url/presigned-url.controller.ts | 11 +++++++++-- server/src/presigned-url/presigned-url.service.ts | 8 ++++---- server/src/video/dto/video-rating.dto.ts | 2 +- 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/server/src/presigned-url/dto/profile-presigned-url-request.dto.ts b/server/src/presigned-url/dto/profile-presigned-url-request.dto.ts index 4b05228..0506dd5 100644 --- a/server/src/presigned-url/dto/profile-presigned-url-request.dto.ts +++ b/server/src/presigned-url/dto/profile-presigned-url-request.dto.ts @@ -1,12 +1,4 @@ -import { IsUUID } from 'class-validator'; - export class ProfilePresignedUrlRequestDto { - /** - * user uuid - */ - @IsUUID() - uuid: string; - /** * 프로필 이미지 확장자 * @example 'webp' diff --git a/server/src/presigned-url/presigned-url.controller.ts b/server/src/presigned-url/presigned-url.controller.ts index 76a4e90..dc55cf6 100644 --- a/server/src/presigned-url/presigned-url.controller.ts +++ b/server/src/presigned-url/presigned-url.controller.ts @@ -5,6 +5,7 @@ import { AuthGuard } from 'src/auth/auth.guard'; import { InvalidTokenException } from 'src/exceptions/invalid-token.exception'; import { TokenExpiredException } from 'src/exceptions/token-expired.exception'; import { ApiSuccessResponse } from 'src/decorators/api-succes-response'; +import { RequestUser, User } from 'src/decorators/request-user'; import { PresignedUrlService } from './presigned-url.service'; import { AdvertisementPresignedUrlRequestDto } from './dto/advertisement-presigned-url-request.dto'; import { ProfilePresignedUrlRequestDto } from './dto/profile-presigned-url-request.dto'; @@ -46,8 +47,14 @@ export class PresignedUrlController { '프로필 이미지를 업로드하는 url 발급 성공', PresignedUrlResponseDto, ) - putProfilePresignedUrl(@Query() query: ProfilePresignedUrlRequestDto) { - return this.presignedUrlService.putProfilePresignedUrl(query); + putProfilePresignedUrl( + @Query() query: ProfilePresignedUrlRequestDto, + @RequestUser() user: User, + ) { + return this.presignedUrlService.putProfilePresignedUrl( + user.id, + query.profileExtension, + ); } /** diff --git a/server/src/presigned-url/presigned-url.service.ts b/server/src/presigned-url/presigned-url.service.ts index 9a0a8c9..7d5012e 100644 --- a/server/src/presigned-url/presigned-url.service.ts +++ b/server/src/presigned-url/presigned-url.service.ts @@ -41,10 +41,10 @@ export class PresignedUrlService { return { advertisements }; } - async putProfilePresignedUrl({ - uuid, - profileExtension, - }): Promise { + async putProfilePresignedUrl( + uuid: string, + profileExtension: string, + ): Promise { const objectName = `${uuid}.${profileExtension}`; const presignedUrl = await createPresignedUrl( process.env.PROFILE_BUCKET, diff --git a/server/src/video/dto/video-rating.dto.ts b/server/src/video/dto/video-rating.dto.ts index a96fbfa..7caf858 100644 --- a/server/src/video/dto/video-rating.dto.ts +++ b/server/src/video/dto/video-rating.dto.ts @@ -6,7 +6,7 @@ export class VideoRatingDTO { * @example 2 */ @IsNumber() - @Min(1) + @Min(0) @Max(5) rating: number;