Skip to content

Commit

Permalink
feat : 프로필 변경 Presigned Url시 UUID 대신 JWT로 검증-별점 0점까지 등록가능
Browse files Browse the repository at this point in the history
  • Loading branch information
msjang4 committed Dec 1, 2023
1 parent 9f37ee2 commit 3976412
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
import { IsUUID } from 'class-validator';

export class ProfilePresignedUrlRequestDto {
/**
* user uuid
*/
@IsUUID()
uuid: string;

/**
* 프로필 이미지 확장자
* @example 'webp'
Expand Down
11 changes: 9 additions & 2 deletions server/src/presigned-url/presigned-url.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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,
);
}

/**
Expand Down
8 changes: 4 additions & 4 deletions server/src/presigned-url/presigned-url.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ export class PresignedUrlService {
return { advertisements };
}

async putProfilePresignedUrl({
uuid,
profileExtension,
}): Promise<PresignedUrlResponseDto> {
async putProfilePresignedUrl(
uuid: string,
profileExtension: string,
): Promise<PresignedUrlResponseDto> {
const objectName = `${uuid}.${profileExtension}`;
const presignedUrl = await createPresignedUrl(
process.env.PROFILE_BUCKET,
Expand Down
2 changes: 1 addition & 1 deletion server/src/video/dto/video-rating.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export class VideoRatingDTO {
* @example 2
*/
@IsNumber()
@Min(1)
@Min(0)
@Max(5)
rating: number;

Expand Down

0 comments on commit 3976412

Please sign in to comment.