-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/#64 좋아요 토글 api 구현 #69
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
Open
pykido
wants to merge
14
commits into
develop
Choose a base branch
from
Feature/#64-좋아요_토글_API_구현
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
The head ref may contain hidden characters: "Feature/#64-\uC88B\uC544\uC694_\uD1A0\uAE00_API_\uAD6C\uD604"
+699
−21
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
3114aca
refactor : 팀 좋아요 토글 API 구현 완료
pykido 12ebbb7
refactor : 에러명 수정
pykido ab45b00
test : 팀 좋아요 토글 API 테스트 코드 작성 완료
pykido a441591
refactor : 투표 토글 API 참고하여 리팩토링하기
pykido 44eac9f
test : 테스트 코드 추가
pykido 90c910e
docs : docs Test 및 docs 작성
pykido f2354a8
refactor : 개행 추가
pykido 32e7bb3
refactor : 테이블 유니크 제약조건 추가
pykido 8279062
docs : .adoc 수정
pykido 097e33f
refactor : TeamLike 엔티티 저장 로직 리팩토링
pykido 30c0d62
refactor : final 누락된 부분 붙이기
pykido cdce7be
refactor : 컨트롤러, 서비스 파일 통합하기
pykido 0a9c9c7
Merge branch 'develop' into Feature/#64-좋아요_토글_API_구현
pykido c9aacb1
test : 테스트 코드 간단 수정
pykido 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
140 changes: 140 additions & 0 deletions
140
src/main/java/com/opus/opus/docs/asciidoc/team-like.adoc
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,140 @@ | ||
| ifndef::snippets[] | ||
| :snippets: ./build/generated-snippets | ||
| endif::[] | ||
|
|
||
| = TEAM LIKE API 문서 | ||
| :doctype: book | ||
| :icons: font | ||
| :source-highlighter: highlightjs | ||
| :toc: left | ||
| :toclevels: 3 | ||
| :sectnums: | ||
|
|
||
| == API 목록 | ||
|
|
||
| link:./opus.html[API 목록으로 돌아가기] | ||
|
|
||
| == `PUT`: 팀 좋아요 토글 | ||
|
|
||
| 해당 팀에 대해 좋아요(찜) 상태를 토글합니다. | ||
|
|
||
| * `isLiked: true` → 좋아요 등록 | ||
| * `isLiked: false` → 좋아요 취소 | ||
|
|
||
| NOTE: 좋아요를 통해 팀을 찜할 수 있습니다. | ||
|
|
||
| NOTE: 투표 기간에는 투표만 가능하고, 투표 기간이 아닐 때만 좋아요가 가능합니다. | ||
|
|
||
| .Path Parameters | ||
| include::{snippets}/toggle-team-like/path-parameters.adoc[] | ||
|
|
||
| .HTTP Request Headers | ||
| include::{snippets}/toggle-team-like/request-headers.adoc[] | ||
|
|
||
| .HTTP Request | ||
| include::{snippets}/toggle-team-like/http-request.adoc[] | ||
|
|
||
| .HTTP Response | ||
| include::{snippets}/toggle-team-like/http-response.adoc[] | ||
|
|
||
| .Request Fields | ||
| include::{snippets}/toggle-team-like/request-fields.adoc[] | ||
|
|
||
| .Response Fields | ||
| include::{snippets}/toggle-team-like/response-fields.adoc[] | ||
|
|
||
| === 시나리오별 응답 | ||
|
|
||
| ==== 시나리오 1: TeamLike 데이터가 없는 경우 | ||
|
|
||
| 특정 멤버가 특정 팀에 대해 좋아요 API를 처음 호출하면, TeamLike 테이블에 데이터가 새로 생성됩니다. | ||
|
|
||
| [cols="1,2,1"] | ||
| |=== | ||
| |Request isLiked |응답 메시지 |HTTP 상태 코드 | ||
|
|
||
| |true | ||
| |좋아요가 등록되었습니다. | ||
| |200 OK | ||
|
|
||
| |false | ||
| |아직 좋아요하지 않은 팀입니다. | ||
| |400 Bad Request | ||
| |=== | ||
|
|
||
| ==== 시나리오 2: TeamLike 데이터가 있는 경우 | ||
|
|
||
| 이미 해당 팀에 대한 좋아요 기록이 있는 경우, 상태에 따라 토글됩니다. | ||
|
|
||
| [cols="1,1,2,1"] | ||
| |=== | ||
| |현재 isLiked |Request isLiked |응답 메시지 |HTTP 상태 코드 | ||
|
|
||
| |true | ||
| |true | ||
| |이미 좋아요한 팀입니다. | ||
| |400 Bad Request | ||
|
|
||
| |true | ||
| |false | ||
| |좋아요가 취소되었습니다. | ||
| |200 OK | ||
|
|
||
| |false | ||
| |true | ||
| |좋아요가 등록되었습니다. | ||
| |200 OK | ||
|
|
||
| |false | ||
| |false | ||
| |이미 좋아요를 취소한 팀입니다. | ||
| |400 Bad Request | ||
| |=== | ||
|
|
||
|
|
||
| === ⚠️ 실패 케이스 | ||
|
|
||
pykido marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| .❌ Case 1: 존재하지 않는 팀 | ||
|
|
||
| [%collapsible] | ||
| ==== | ||
| include::{snippets}/toggle-team-like-fail-not-found/http-request.adoc[] | ||
|
|
||
| include::{snippets}/toggle-team-like-fail-not-found/http-response.adoc[] | ||
| ==== | ||
|
|
||
| .❌ Case 2: 이미 좋아요한 팀 | ||
|
|
||
| [%collapsible] | ||
| ==== | ||
| include::{snippets}/toggle-team-like-fail-already-liked/http-request.adoc[] | ||
|
|
||
| include::{snippets}/toggle-team-like-fail-already-liked/http-response.adoc[] | ||
| ==== | ||
|
|
||
| .❌ Case 3: 이미 좋아요 취소한 팀 | ||
|
|
||
| [%collapsible] | ||
| ==== | ||
| include::{snippets}/toggle-team-like-fail-already-unliked/http-request.adoc[] | ||
|
|
||
| include::{snippets}/toggle-team-like-fail-already-unliked/http-response.adoc[] | ||
| ==== | ||
|
|
||
| .❌ Case 4: 좋아요한 적 없는 팀에 취소 요청 | ||
|
|
||
| [%collapsible] | ||
| ==== | ||
| include::{snippets}/toggle-team-like-fail-not-liked-yet/http-request.adoc[] | ||
|
|
||
| include::{snippets}/toggle-team-like-fail-not-liked-yet/http-response.adoc[] | ||
| ==== | ||
|
|
||
| .❌ Case 5: 투표 기간 중 좋아요 요청 | ||
|
|
||
| [%collapsible] | ||
| ==== | ||
| include::{snippets}/toggle-team-like-fail-voting-period/http-request.adoc[] | ||
|
|
||
| include::{snippets}/toggle-team-like-fail-voting-period/http-response.adoc[] | ||
| ==== | ||
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
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
9 changes: 9 additions & 0 deletions
9
src/main/java/com/opus/opus/modules/team/application/dto/request/TeamLikeToggleRequest.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,9 @@ | ||
| package com.opus.opus.modules.team.application.dto.request; | ||
|
|
||
| import jakarta.validation.constraints.NotNull; | ||
|
|
||
| public record TeamLikeToggleRequest( | ||
| @NotNull(message = "isLiked 값은 필수입니다.") | ||
| Boolean isLiked | ||
| ) { | ||
| } |
11 changes: 11 additions & 0 deletions
11
...main/java/com/opus/opus/modules/team/application/dto/response/TeamLikeToggleResponse.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,11 @@ | ||
| package com.opus.opus.modules.team.application.dto.response; | ||
|
|
||
| public record TeamLikeToggleResponse( | ||
| Long teamId, | ||
| Boolean isLiked, | ||
| String message | ||
| ) { | ||
| public static TeamLikeToggleResponse of(Long teamId, Boolean isLiked, String message) { | ||
| return new TeamLikeToggleResponse(teamId, isLiked, message); | ||
| } | ||
| } |
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
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.