-
Notifications
You must be signed in to change notification settings - Fork 0
[Feat] 게시물 좋아요 상태변경 api 개발 #164
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
Changes from all commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
c27d664
[refactor] 게시물 공통 인터페이스 CountUpdatable로 이름 변경 (#159)
hd0rable 51a57c8
[feat] 관련 에러 코드 추가 (#159)
hd0rable 9756e36
[feat] 게시물 도메인 좋아요 업데이트 함수 구현 (#159)
hd0rable 08305f9
[feat] 피드 좋아요 상태 변경 컨트롤러 작성 (#159)
hd0rable 52a6f6f
[feat] 피드 좋아요 상태 변경 request dto 작성 (#159)
hd0rable 633a964
[feat] 피드 좋아요 상태 변경 reponse dto 작성 (#159)
hd0rable e987799
[refactor] 게시물 공통 인터페이스 CountUpdatable로 이름 변경 (#159)
hd0rable b2d746d
[feat] 게시물 테스트용 좋아요 업데이트 함수 추가 (#159)
hd0rable c83cdf4
[feat] 게시글 좋아요 접근 정책 인터페이스 작성(#159)
hd0rable 142649f
[feat] 게시글 좋아요 접근 정책 config 작성 (#159)
hd0rable c66515a
[feat] 피드 좋아요 접근 정책 구현 (#159)
hd0rable 5e0456e
[feat] 게시글 좋아요 상태 변경 command 작성 (#159)
hd0rable 6e6f0d2
[feat] 게시글 좋아요 상태 변경 PostIsLikeResult 작성 (#159)
hd0rable 455d85a
[feat] 게시글 좋아요 접근 정책 PostLikeAuthorizationValidator 작성(#159)
hd0rable 6c9b7dc
[feat] PostLikeCommandPersistenceAdapter 관련 함수 추가(#159)
hd0rable f539ee3
[feat] PostLikeCommandPort 관련 함수 추가(#159)
hd0rable 0440180
[feat] PostLikeJpaRepository 관련 함수 추가(#159)
hd0rable 879df31
[feat] PostLikeQueryPersistenceAdapter.isLikedPostByUser 함수 추가(#159)
hd0rable b8a54ba
[feat] PostLikeQueryPort.isLikedPostByUser 함수 추가(#159)
hd0rable 0d812fd
[feat] 게시글 좋아요 상태 변경 PostLikeUseCase 유즈케이스 작성 (#159)
hd0rable 7854ac9
[feat] 게시글 좋아요 상태 변경 유즈케이스 구현체 서비스 작성 (#159)
hd0rable 626d4e1
[refactor] 안쓰는 함수 삭제 (#159)
hd0rable ffd4a20
[feat] 방 게시글 좋아요 상태 변경 컨트롤러 작성 (#163)
hd0rable 2af4c79
[refactor] 게시물 공통 인터페이스 CountUpdatable로 이름 변경 (#159)
hd0rable 36234fe
[refactor] 게시물 공통 인터페이스 CountUpdatable로 이름 변경 (#159)
hd0rable 369a6d4
[feat] 방 게시물 좋아요 상태 변경 request dto 작성 (#159)
hd0rable b12f92a
[feat] 방 게시물 좋아요 상태 변경 response dto 작성 (#159)
hd0rable 951fa12
[feat] 방 게시물 좋아요 접근 정책 작성 (#159)
hd0rable d2a74a2
[feat] 방 게시물타입 enum 작성 (#159)
hd0rable 1083e7e
[feat] 관련 api 스웨거 에러코드 추가 (#159)
hd0rable 97f7fac
[test] 피드 좋아요 상태 변경 통합 테스트 코드 작성 (#159)
hd0rable ece397c
[test] 피드 좋아요 상태 변경 관련 피드 도메인 단위 테스트 코드 작성 (#159)
hd0rable a55267e
[test] 관련 팩토리 메서드 추가 (#159)
hd0rable c49896b
[test] 방 게시물 좋아요 상태 변경 통합 테스트 코드 작성 (#163)
hd0rable d66129e
[test] 방 게시물 좋아요 상태 변경 관련 컨트롤러단위 테스트 코드 작성 (#163)
hd0rable cd7881b
[test] 방 게시물 좋아요 상태 변경 관련 레코드 도메인 단위 테스트 코드 작성 (#163)
hd0rable 7d1959e
[test] 방 게시물 좋아요 상태 변경 관련 투표 도메인 단위 테스트 코드 작성 (#163)
hd0rable 9f46344
[refactor] 변수 이름 변경 (#163)
hd0rable fc9421e
[refactor] 스트림 대신 적은 수의경우 직접 비교 성능 최적화(#163)
hd0rable 5a926bd
[refactor] feedId 오타 수정 (#163)
hd0rable 27e85d9
[refactor] roomPost 오타 수정 (#163)
hd0rable 3b2e896
[refactor] 비공개 게시글 일 경우 댓글,좋아요 검증 함수 합치기 (#163)
hd0rable 96e7bb2
[docs] 진행중인 방 상세보기 명세 수정 (#159)
buzz0331 c15a9f5
[refactor] 게시물 수 증가 도메인 서비스 작성(#159)
hd0rable 09f81bd
[refactor] 게시물 수 증가 도메인 서비스 이용한 로직으로 수정 (#159)
hd0rable 1daf813
[refactor] 테스트코드 수정 (#159)
hd0rable e6fcdbe
[fix] 스웨거 허용 주소 추가
hd0rable 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 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
4 changes: 2 additions & 2 deletions
4
src/main/java/konkuk/thip/comment/application/service/policy/CommentAccessPolicy.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,7 +1,7 @@ | ||
| package konkuk.thip.comment.application.service.policy; | ||
|
|
||
| import konkuk.thip.common.post.CommentCountUpdatable; | ||
| import konkuk.thip.common.post.CountUpdatable; | ||
|
|
||
| public interface CommentAccessPolicy { | ||
| void validateCommentAccess(CommentCountUpdatable post, Long userId); | ||
| void validateCommentAccess(CountUpdatable post, Long userId); | ||
| } |
4 changes: 2 additions & 2 deletions
4
src/main/java/konkuk/thip/comment/application/service/policy/FeedCommentAccessPolicy.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
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
7 changes: 0 additions & 7 deletions
7
src/main/java/konkuk/thip/common/post/CommentCountUpdatable.java
This file was deleted.
Oops, something went wrong.
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,10 @@ | ||
| package konkuk.thip.common.post; | ||
|
|
||
| import konkuk.thip.post.domain.service.PostCountService; | ||
|
|
||
| public interface CountUpdatable { //TODO 패키지 구조 충돌안나게 한번에 옮기기 | ||
| void increaseCommentCount(); | ||
| void decreaseCommentCount(); | ||
| void updateLikeCount(PostCountService postCountService, boolean isLike); | ||
| Long getId(); | ||
| } | ||
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
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 |
|---|---|---|
|
|
@@ -4,6 +4,9 @@ | |
| import konkuk.thip.comment.application.service.policy.FeedCommentAccessPolicy; | ||
| import konkuk.thip.comment.application.service.policy.RoomPostCommentAccessPolicy; | ||
| import konkuk.thip.common.post.PostType; | ||
| import konkuk.thip.post.application.service.policy.FeedLikeAccessPolicy; | ||
| import konkuk.thip.post.application.service.policy.PostLikeAccessPolicy; | ||
| import konkuk.thip.post.application.service.policy.RoomPostLikeAccessPolicy; | ||
| import lombok.RequiredArgsConstructor; | ||
| import org.springframework.context.annotation.Bean; | ||
| import org.springframework.context.annotation.Configuration; | ||
|
|
@@ -12,11 +15,14 @@ | |
|
|
||
| @Configuration | ||
| @RequiredArgsConstructor | ||
| public class CommentAccessPolicyConfig { | ||
| public class PostAccessPolicyConfig { | ||
|
|
||
| private final FeedCommentAccessPolicy feedCommentPolicy; | ||
| private final RoomPostCommentAccessPolicy roomCommentPolicy; | ||
|
|
||
| private final FeedLikeAccessPolicy feedLikePolicy; | ||
| private final RoomPostLikeAccessPolicy roomPostLikePolicy; | ||
|
|
||
| @Bean | ||
| public Map<PostType, CommentAccessPolicy> commentAccessPolicyMap() { | ||
| return Map.of( | ||
|
|
@@ -25,4 +31,13 @@ public Map<PostType, CommentAccessPolicy> commentAccessPolicyMap() { | |
| PostType.VOTE, roomCommentPolicy | ||
| ); | ||
| } | ||
|
|
||
| @Bean | ||
| public Map<PostType, PostLikeAccessPolicy> postLikeAccessPolicyMap() { | ||
| return Map.of( | ||
| PostType.FEED, feedLikePolicy, | ||
| PostType.RECORD, roomPostLikePolicy, | ||
| PostType.VOTE, roomPostLikePolicy | ||
| ); | ||
| } | ||
| } | ||
|
Comment on lines
+35
to
43
Collaborator
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. LGTM |
||
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
18 changes: 18 additions & 0 deletions
18
src/main/java/konkuk/thip/feed/adapter/in/web/request/FeedIsLikeRequest.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,18 @@ | ||
| package konkuk.thip.feed.adapter.in.web.request; | ||
|
|
||
| import io.swagger.v3.oas.annotations.media.Schema; | ||
| import jakarta.validation.constraints.NotNull; | ||
| import konkuk.thip.post.application.port.in.dto.PostIsLikeCommand; | ||
|
|
||
| import static konkuk.thip.common.post.PostType.FEED; | ||
|
|
||
| @Schema(description = "피드 좋아요 상태 변경 요청 DTO") | ||
| public record FeedIsLikeRequest( | ||
| @Schema(description = "좋아요 여부 type (true -> 좋아요, false -> 좋아요 취소)", example = "true") | ||
| @NotNull(message = "좋아요 여부는 필수입니다.") | ||
| Boolean type | ||
| ) { | ||
| public PostIsLikeCommand toCommand(Long userId, Long feedId) { | ||
| return new PostIsLikeCommand(userId, feedId, FEED ,type); | ||
| } | ||
| } | ||
|
Comment on lines
+9
to
+18
Contributor
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. 오호 이렇게 상수로 넣어주었군요!! 굿굿 좋습니다! |
||
12 changes: 12 additions & 0 deletions
12
src/main/java/konkuk/thip/feed/adapter/in/web/response/FeedIsLikeResponse.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 konkuk.thip.feed.adapter.in.web.response; | ||
|
|
||
| import konkuk.thip.post.application.port.in.dto.PostIsLikeResult; | ||
|
|
||
| public record FeedIsLikeResponse( | ||
| Long feedId, | ||
| boolean isLiked | ||
| ) { | ||
| public static FeedIsLikeResponse of(PostIsLikeResult postIsLikeResult) { | ||
| return new FeedIsLikeResponse(postIsLikeResult.postId(), postIsLikeResult.isLiked()); | ||
| } | ||
| } |
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.
p3: getId는 어차피 공통으로 getter를 사용하는 것 같아서 굳이 없어도 될 것 같습니다!
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.
앗 이거 공통로직시에 updatable에서 뽑아올때 필요합니닷!!
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.
아하 흐음 이건 어쩔수 없이 열어둬야 될 것 같네여 🤔