Skip to content

Commit

Permalink
YEL-193 [feat] vote type fix
Browse files Browse the repository at this point in the history
  • Loading branch information
hyeonjeongs committed Jan 30, 2024
1 parent c592b43 commit bc6b303
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
@Getter
@RequiredArgsConstructor
public enum VoteType {
send("send");
SEND("send");

private final String intial;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ public VoteFriendResponse findAllFriendVotes(Long userId, Pageable pageable) {
return VoteFriendResponse.of(totalCount, list);
}

public VoteFriendAndUserResponse findAllFriendVotesWithType(Long userId, Pageable pageable, String type) {
public VoteFriendAndUserResponse findAllFriendVotesWithType(Long userId, Pageable pageable, String voteType) {

if(!StringUtils.hasText(type)) {
if(!StringUtils.hasText(voteType)) {
final Long totalCount = Long.valueOf(voteRepository.countAllReceivedByFriends(userId));
final List<VoteFriendAndUserVO> list = voteRepository.findAllReceivedByFriends(userId, pageable)
.stream()
Expand All @@ -133,8 +133,8 @@ public VoteFriendAndUserResponse findAllFriendVotesWithType(Long userId, Pageabl
return VoteFriendAndUserResponse.of(totalCount, list);
}

switch(VoteType.valueOf(type)) {
case send -> {
switch(VoteType.fromCode(voteType)) {
case SEND -> {
final Long totalCount = voteRepository.countUserSendReceivedByFriends(userId);
List<VoteFriendAndUserVO> list =
voteRepository.findUserSendReceivedByFriends(userId, pageable)
Expand Down
9 changes: 8 additions & 1 deletion src/main/resources/static/docs/find-friend-votes-v2.html
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,14 @@ <h3 id="_note">NOTE</h3>
<div class="ulist">
<ul>
<li>
<p>모든 종류의 쪽지를 조회할 때 <code>/api/v1/vote/friend?page=0&amp;type=null</code> 으로 요청해주세요</p>
<p>모든 종류의 쪽지를 조회할 때 <code>/api/v1/vote/friend?page=0</code> 으로 요청해주세요</p>
<div class="ulist">
<ul>
<li>
<p>type을 명시하지 마세요</p>
</li>
</ul>
</div>
</li>
<li>
<p>내가 보낸 쪽지를 조회할 때 <code>/api/v1/vote/friend?page=0&amp;type=send</code> 으로 요청해주세요</p>
Expand Down

0 comments on commit bc6b303

Please sign in to comment.