-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
비디오 업로드 예외처리 #164
Merged
Merged
비디오 업로드 예외처리 #164
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
f1e2373
refactor : 회원가입/프로필 변경 시 프로필 이미지 업로드 presigned url 발급하는 api 분리
5tarry 2494fe3
feat : 중복된 비디오 Id 예외처리
5tarry 828450c
feat : 비디오 업로드 시 파일 업로드 확인하는 예외처리
5tarry 04348e5
feat : 비디오 업로드 api 예외처리 응답 명세
5tarry 9f37ee2
refactor : 예외처리 수정
5tarry 3976412
feat : 프로필 변경 Presigned Url시 UUID 대신 JWT로 검증-별점 0점까지 등록가능
msjang4 d5e96c2
feat : 회원가입 프로필 presignedURL 발급 요청 스키마에 소셜 accessToken 추가-conflict 예외처리
msjang4 12a6771
chore : Swagger 명세 수정 및 Request DTO validator 작성
msjang4 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { HttpStatus } from '@nestjs/common'; | ||
import { ErrorCode } from 'src/exceptions/enum/exception.enum'; | ||
import { BaseException } from './base.exception'; | ||
|
||
export class BadRequestFormatException extends BaseException { | ||
constructor() { | ||
super(ErrorCode.BadRequestFormat, HttpStatus.BAD_REQUEST); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
enum ErrorCode { | ||
UserConflict = 3001, | ||
VideoConflict = 3002, | ||
BadRequest = 2000, | ||
LoginFail = 1000, | ||
TokenExpired = 1001, | ||
|
@@ -17,10 +18,12 @@ enum ErrorCode { | |
VideoUploadRequired = 5004, | ||
BadVideoFormat = 8000, | ||
BadThumbnailFormat = 8100, | ||
BadRequestFormat = 8200, | ||
} | ||
|
||
const ErrorMessage = { | ||
[ErrorCode.UserConflict]: '이미 가입된 회원', | ||
[ErrorCode.VideoConflict]: '중복된 Video Id', | ||
[ErrorCode.BadRequest]: '잘못된 요청 형식', | ||
[ErrorCode.LoginFail]: '가입되지 않은 회원', | ||
[ErrorCode.TokenExpired]: 'AccessToken 만료', | ||
|
@@ -33,10 +36,11 @@ const ErrorMessage = { | |
[ErrorCode.NeverViewVideo]: '시청한 영상만 별점을 등록할 수 있음', | ||
[ErrorCode.VideoNotFound]: '비디오를 찾을 수 없음', | ||
[ErrorCode.UserNotFound]: '유저를 찾을 수 없음', | ||
[ErrorCode.ObjectNotFound]: '오브젝트를 찾을 수 없음', | ||
[ErrorCode.ObjectNotFound]: '파일을 찾을 수 없음', | ||
[ErrorCode.ProfileUploadRequired]: '프로필 이미지를 먼저 업로드 해야합니다.', | ||
[ErrorCode.ThumbnailUploadRequired]: '썸네일을 먼저 업로드 해야합니다.', | ||
[ErrorCode.VideoUploadRequired]: '비디오를 먼저 업로드 해야합니다.', | ||
[ErrorCode.BadRequestFormat]: '요청 형식이 잘못됨', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 리뷰 반영 감사합니다! 👍 |
||
}; | ||
|
||
export { ErrorCode, ErrorMessage }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { HttpStatus } from '@nestjs/common'; | ||
import { ErrorCode } from 'src/exceptions/enum/exception.enum'; | ||
import { BaseException } from './base.exception'; | ||
|
||
export class VideoConflictException extends BaseException { | ||
constructor() { | ||
super(ErrorCode.VideoConflict, HttpStatus.CONFLICT); | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
server/src/presigned-url/dto/advertisement-presigned-url-request.dto.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
import { IsNotEmpty, IsOptional } from 'class-validator'; | ||
|
||
export class AdvertisementPresignedUrlRequestDto { | ||
/** | ||
* 특정 광고 이미지의 presigned url만 받고 싶은 경우 | ||
* @example 'test.webp' | ||
*/ | ||
@IsOptional() | ||
@IsNotEmpty() | ||
name?: string; | ||
} |
9 changes: 2 additions & 7 deletions
9
server/src/presigned-url/dto/profile-presigned-url-request.dto.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,10 @@ | ||
import { IsUUID } from 'class-validator'; | ||
import { IsNotEmpty } from 'class-validator'; | ||
|
||
export class ProfilePresignedUrlRequestDto { | ||
/** | ||
* user uuid | ||
*/ | ||
@IsUUID() | ||
uuid: string; | ||
|
||
/** | ||
* 프로필 이미지 확장자 | ||
* @example 'webp' | ||
*/ | ||
@IsNotEmpty() | ||
profileExtension: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
server/src/presigned-url/dto/signup-profile-presigned-url-request.dto.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { IsNotEmpty, IsUUID } from 'class-validator'; | ||
import { ProfilePresignedUrlRequestDto } from './profile-presigned-url-request.dto'; | ||
|
||
export class SignupProfilePresignedUrlRequestDto extends ProfilePresignedUrlRequestDto { | ||
/** | ||
* 유저 ID | ||
* @example '550e8400-e29b-41d4-a716-446655440000' | ||
*/ | ||
@IsUUID() | ||
uuid: string; | ||
|
||
/** | ||
* 소셜 accessToken | ||
* @example '1/fFAGRNJru1FTz70BzhT3Zg' | ||
*/ | ||
@IsNotEmpty() | ||
accessToken: string; | ||
} |
4 changes: 4 additions & 0 deletions
4
server/src/presigned-url/dto/video-presigned-url-request.dto.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,17 @@ | ||
import { IsNotEmpty } from 'class-validator'; | ||
|
||
export class VIdeoPresignedUrlRequestDto { | ||
/** | ||
* 비디오 확장자 | ||
* @example 'mp4' | ||
*/ | ||
@IsNotEmpty() | ||
videoExtension: string; | ||
|
||
/** | ||
* 썸네일 이미지 확장자 | ||
* @example 'webp' | ||
*/ | ||
@IsNotEmpty() | ||
thumbnailExtension: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ export class VideoRatingDTO { | |
* @example 2 | ||
*/ | ||
@IsNumber() | ||
@Min(1) | ||
@Min(0) | ||
@Max(5) | ||
rating: number; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이렇게 프로필이미지 put presigned Url 발급을 나눈게 굉장히 좋은 거 같아요!
프로필 변경시 발급에서는 본인 Id만 발급가능하도록 할 수 있고, 회원가입시 발급에서는 DB에 없는 Id만 발급가능하게 해서 예외처리 할 수 있으니까요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ㅎㅎㅎ