-
Notifications
You must be signed in to change notification settings - Fork 0
[#22] 작품 회차 등록 #29
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
Merged
Merged
[#22] 작품 회차 등록 #29
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
7dbac04
[#22] feat: 회차등록 관련 엔티티 추가
hado0123 c66b2b4
[#22] feat: 회차 썸네일 이미지 S3 업로드 처리
hado0123 21c52da
[#22] feat: 회차 원고 이미지 S3 업로드 처리
hado0123 9b67bf7
[#22] feat: 회차 등록 구현
hado0123 f545472
[#22] refactor: FILE_NOT_FOUND Exception 메세지 오타 수정
hado0123 6bddac1
[#22] refactor: 업로드 원고 파일 갯수 50장으로 통일
hado0123 6641fcb
[#22] refactor: 회차 등록시 작가 역할 확인, 해당 작품의 작가인지 확인
hado0123 06eeefc
[#22] refactor: ManuscriptImageService, EpisodeThumbnailService 분리
hado0123 d559fab
[#22] refactor: displayOrder 타입 Integer로 변경하고 short 변환 로직 제거
hado0123 10b980e
[#22] refactor: file_object 테이블 insert 혹은 update stream 함수형 처리
hado0123 e592764
[#22] fix: status 변경
hado0123 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
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
31 changes: 26 additions & 5 deletions
31
src/main/java/com/creatorhub/constant/CreationThumbnailType.java
This file contains hidden or 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,8 +1,29 @@ | ||
| package com.creatorhub.constant; | ||
|
|
||
| public enum CreationThumbnailType { | ||
| POSTER, // 포스터형 | ||
| HORIZONTAL, // 가로형 | ||
| DERIVED, // 리사이징(파생) 이미지 | ||
| EXTRA // 리사이징 후 별도로 수정한 이미지 | ||
| public enum CreationThumbnailType implements ThumbnailType { | ||
| POSTER { | ||
| @Override | ||
| public String resolveSuffix() { | ||
| return ThumbnailKeys.POSTER_SUFFIX; | ||
| } | ||
| }, | ||
| HORIZONTAL { | ||
| @Override | ||
| public String resolveSuffix() { | ||
| return ThumbnailKeys.HORIZONTAL_SUFFIX; | ||
| } | ||
| }, | ||
| DERIVED { | ||
| @Override | ||
| public String resolveSuffix() { | ||
| return null; | ||
| } | ||
| }, | ||
| EXTRA { | ||
| @Override | ||
| public String resolveSuffix() { | ||
| return null; | ||
| } | ||
| } | ||
| } | ||
|
|
16 changes: 16 additions & 0 deletions
16
src/main/java/com/creatorhub/constant/EpisodeThumbnailType.java
This file contains hidden or 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,16 @@ | ||
| package com.creatorhub.constant; | ||
|
|
||
| public enum EpisodeThumbnailType implements ThumbnailType { | ||
| EPISODE { | ||
| @Override | ||
| public String resolveSuffix() { | ||
| return ThumbnailKeys.EPISODE_SUFFIX; | ||
| } | ||
| }, | ||
| SNS { | ||
| @Override | ||
| public String resolveSuffix() { | ||
| return ThumbnailKeys.SNS_SUFFIX; | ||
| } | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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,6 @@ | ||
| package com.creatorhub.constant; | ||
|
|
||
| public interface ThumbnailType { | ||
| String resolveSuffix(); | ||
| } | ||
|
|
This file contains hidden or 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
50 changes: 50 additions & 0 deletions
50
src/main/java/com/creatorhub/controller/EpisodeController.java
This file contains hidden or 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,50 @@ | ||
| package com.creatorhub.controller; | ||
|
|
||
| import com.creatorhub.dto.EpisodeRequest; | ||
| import com.creatorhub.dto.EpisodeResponse; | ||
| import com.creatorhub.security.auth.CustomUserPrincipal; | ||
| import com.creatorhub.service.EpisodeService; | ||
| import jakarta.validation.Valid; | ||
| import lombok.RequiredArgsConstructor; | ||
| import lombok.extern.slf4j.Slf4j; | ||
| import org.springframework.http.ResponseEntity; | ||
| import org.springframework.security.access.prepost.PreAuthorize; | ||
| import org.springframework.security.core.annotation.AuthenticationPrincipal; | ||
| import org.springframework.web.bind.annotation.PostMapping; | ||
| import org.springframework.web.bind.annotation.RequestBody; | ||
| import org.springframework.web.bind.annotation.RequestMapping; | ||
| import org.springframework.web.bind.annotation.RestController; | ||
|
|
||
| @RestController | ||
| @RequestMapping("/api/episodes") | ||
| @RequiredArgsConstructor | ||
| @Slf4j | ||
| public class EpisodeController { | ||
|
|
||
| private final EpisodeService episodeService; | ||
|
|
||
| /** | ||
| * 회차 등록 + 원고/썸네일 매핑 insert | ||
| */ | ||
| @PreAuthorize("hasRole('ROLE_CREATOR')") | ||
| @PostMapping("/create") | ||
| public ResponseEntity<EpisodeResponse> publishEpisode( | ||
| @Valid @RequestBody EpisodeRequest req, | ||
| @AuthenticationPrincipal CustomUserPrincipal principal | ||
| ) { | ||
|
|
||
| log.info("회차 등록 요청 - memberId={}, creationId={}, episodeNum={}, manuscripts={}, episodeFileObjectId={}, snsFileObjectId={}, isPublic={}, isCommentEnabled={}", | ||
| principal.id(), | ||
| req.creationId(), | ||
| req.episodeNum(), | ||
| req.manuscripts().size(), | ||
| req.episodeFileObjectId(), | ||
| req.snsFileObjectId(), | ||
| req.isPublic(), | ||
| req.isCommentEnabled() | ||
| ); | ||
|
|
||
| EpisodeResponse res = episodeService.publishEpisode(req, principal.id()); | ||
| return ResponseEntity.ok(res); | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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,37 @@ | ||
| package com.creatorhub.dto; | ||
|
|
||
| import jakarta.validation.Valid; | ||
| import jakarta.validation.constraints.*; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| public record EpisodeRequest( | ||
| @NotNull(message = "creationId가 존재하지 않습니다.") | ||
| Long creationId, | ||
|
|
||
| @NotNull(message = "episodeNum이 존재하지 않습니다.") | ||
| @Min(value = 1, message = "episodeNum은 1 이상이어야 합니다.") | ||
| Integer episodeNum, | ||
|
|
||
| @NotBlank(message = "title이 존재하지 않습니다.") | ||
| @Size(max = 35, message = "title은 35자 이하여야 합니다.") | ||
| String title, | ||
|
|
||
| @NotBlank(message = "creatorNote가 존재하지 않습니다.") | ||
| @Size(max = 100, message = "creatorNote는 100자 이하여야 합니다.") | ||
| String creatorNote, | ||
|
|
||
| Boolean isCommentEnabled, | ||
| Boolean isPublic, | ||
|
|
||
| @NotNull(message = "회차 썸네일의 FileObjectId가 존재하지 않습니다.") | ||
| Long episodeFileObjectId, | ||
|
|
||
| @NotNull(message = "sns 썸네일의 FileObjectId가 존재하지 않습니다.") | ||
| Long snsFileObjectId, | ||
|
|
||
| @NotEmpty(message = "원고 파일 목록이 비어있습니다.") | ||
| @Size(max = 50, message = "원고는 50장 이하여야 합니다.") // 정책값 | ||
| List<@Valid ManuscriptRegisterItem> manuscripts | ||
|
|
||
| ) { } |
This file contains hidden or 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,11 @@ | ||
| package com.creatorhub.dto; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| public record EpisodeResponse( | ||
| Long episodeId, | ||
| Integer episodeNum, | ||
| List<Long> manuscriptImageIds, | ||
| List<Long> episodeThumbnailIds | ||
| ) { } | ||
|
|
12 changes: 12 additions & 0 deletions
12
src/main/java/com/creatorhub/dto/ManuscriptRegisterItem.java
This file contains hidden or 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,12 @@ | ||
| package com.creatorhub.dto; | ||
|
|
||
| import jakarta.validation.constraints.*; | ||
|
|
||
| public record ManuscriptRegisterItem( | ||
| @NotNull(message = "fileObjectId가 존재하지 않습니다.") | ||
| Long fileObjectId, | ||
|
|
||
| @NotNull(message = "displayOrder가 존재하지 않습니다.") | ||
| @Min(value = 1, message = "displayOrder는 1 이상이어야 합니다.") | ||
| Integer displayOrder | ||
| ) { } |
This file was deleted.
Oops, something went wrong.
23 changes: 23 additions & 0 deletions
23
src/main/java/com/creatorhub/dto/s3/CreationThumbnailPresignedRequest.java
This file contains hidden or 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,23 @@ | ||
| package com.creatorhub.dto.s3; | ||
|
|
||
| import com.creatorhub.constant.CreationThumbnailType; | ||
| import jakarta.validation.constraints.NotBlank; | ||
| import jakarta.validation.constraints.NotNull; | ||
|
|
||
| public record CreationThumbnailPresignedRequest( | ||
|
|
||
| @NotBlank(message = "콘텐츠 타입이 존재하지 않습니다.") | ||
| String contentType, | ||
|
|
||
| @NotNull(message = "썸네일 타입이 존재하지 않습니다.") | ||
| CreationThumbnailType thumbnailType, | ||
|
|
||
| @NotBlank(message = "원본 파일명이 존재하지 않습니다.") | ||
| String originalFilename | ||
|
|
||
| ) implements PresignedPutRequest { | ||
| @Override public String resolveSuffix() { | ||
| return thumbnailType.resolveSuffix(); | ||
| } | ||
| } | ||
|
|
24 changes: 24 additions & 0 deletions
24
src/main/java/com/creatorhub/dto/s3/EpisodeThumbnailPresignedRequest.java
This file contains hidden or 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,24 @@ | ||
| package com.creatorhub.dto.s3; | ||
|
|
||
| import com.creatorhub.constant.CreationThumbnailType; | ||
| import com.creatorhub.constant.EpisodeThumbnailType; | ||
| import jakarta.validation.constraints.NotBlank; | ||
| import jakarta.validation.constraints.NotNull; | ||
|
|
||
| public record EpisodeThumbnailPresignedRequest( | ||
|
|
||
| @NotBlank(message = "콘텐츠 타입이 존재하지 않습니다.") | ||
| String contentType, | ||
|
|
||
| @NotNull(message = "썸네일 타입이 존재하지 않습니다.") | ||
| EpisodeThumbnailType thumbnailType, | ||
|
|
||
| @NotBlank(message = "원본 파일명이 존재하지 않습니다.") | ||
| String originalFilename | ||
|
|
||
| ) implements PresignedPutRequest { | ||
| @Override public String resolveSuffix() { | ||
| return thumbnailType.resolveSuffix(); | ||
| } | ||
| } | ||
|
|
17 changes: 17 additions & 0 deletions
17
src/main/java/com/creatorhub/dto/s3/ManuscriptFileRequest.java
This file contains hidden or 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,17 @@ | ||
| package com.creatorhub.dto.s3; | ||
|
|
||
| import jakarta.validation.constraints.Min; | ||
| import jakarta.validation.constraints.NotBlank; | ||
| import jakarta.validation.constraints.NotNull; | ||
|
|
||
| public record ManuscriptFileRequest ( | ||
| @NotNull(message = "displayOrder가 존재하지 않습니다.") | ||
| @Min(value = 1, message = "displayOrder는 1 이상이어야 합니다.") | ||
| Integer displayOrder, | ||
|
|
||
| @NotBlank(message = "콘텐츠 타입이 존재하지 않습니다.") | ||
| String contentType, | ||
|
|
||
| @NotBlank(message = "원본 파일명이 존재하지 않습니다.") | ||
| String originalFilename | ||
| ){ } |
17 changes: 17 additions & 0 deletions
17
src/main/java/com/creatorhub/dto/s3/ManuscriptPresignedRequest.java
This file contains hidden or 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,17 @@ | ||
| package com.creatorhub.dto.s3; | ||
|
|
||
| import jakarta.validation.Valid; | ||
| import jakarta.validation.constraints.*; | ||
| import java.util.List; | ||
|
|
||
| public record ManuscriptPresignedRequest( | ||
|
|
||
| @NotNull(message = "creatorId가 존재하지 않습니다.") | ||
| Long creationId, | ||
|
|
||
| @NotEmpty(message = "원고 파일 목록이 비어있습니다.") | ||
| @Size(max = 50, message = "원고는 50장 이하여야 합니다.") | ||
| List<@Valid ManuscriptFileRequest> files | ||
|
|
||
| ) { } | ||
|
|
||
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.
Uh oh!
There was an error while loading. Please reload this page.