-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: 나의 뱃지 목록 조회 응답 변경 사항에 맞게 수정 (#292)
* Refactor: AchievedBadgesResponse의 AchievedBadge를 공통으로 사용하기 위해 분리 * Feat: 사용자가 획득한 뱃지를 뱃지 타입순, 최신 획득 순으로 가져오는 repository 추가 * Fix: 뱃지 목록 조회의 새로운 응답 형식 변경에 따른 수정 - AllBadgesListResponse변경 - 기존의 뱃지 목록을 조회하는 repository 삭제 - 필요 없어진 BadgeWithAchieveStatusAndAchievedAt DTO 삭제 - 기존 테스트 코드 삭제 - BagdeType에 타입한글 이름 추가 * Fix: 최신 획득 뱃지는 badgeList에 추가하지 않고 따로 리턴하게 수정 * Test: findByMemberIdOrderByBadgeTypeAndAchievedAt 리파지토리 테스트 * Test: 나의 벳지 목록 조회 서비스 테스트 코드 추가 * Fix: 보여주는 우선순위 값 추가 * Fix: 벳지의 타입 별 보여주는 우선 순위로 배지 리스트 반환하게 수정 * Test: findBadgesList의 잘못된 테스트 코드 수정 * Docs: 나의 뱃지 목록 조회 API 문서 수정 * Fix: Collection 자료형 타입을 interface 타입으로 사용 * Fix: responseBadges 리스트에 forEach로 추가하는 대신, 스트림 map을 이용해 리스트로 반환
- Loading branch information
Showing
16 changed files
with
142 additions
and
291 deletions.
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
12 changes: 0 additions & 12 deletions
12
src/main/java/com/dnd/runus/domain/badge/BadgeWithAchieveStatusAndAchievedAt.java
This file was deleted.
Oops, something went wrong.
20 changes: 15 additions & 5 deletions
20
src/main/java/com/dnd/runus/global/constant/BadgeType.java
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,9 +1,19 @@ | ||
package com.dnd.runus.global.constant; | ||
|
||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
import static lombok.AccessLevel.PRIVATE; | ||
|
||
@Getter | ||
@RequiredArgsConstructor(access = PRIVATE) | ||
public enum BadgeType { | ||
STREAK, | ||
DISTANCE_METER, | ||
PERSONAL_RECORD, | ||
DURATION_SECONDS, | ||
LEVEL, | ||
PERSONAL_RECORD("개인기록", 1), | ||
DISTANCE_METER("러닝거리", 2), | ||
STREAK("연속", 3), | ||
DURATION_SECONDS("시간", 4), | ||
LEVEL("레벨", 5), | ||
; | ||
private final String name; | ||
private final int showPriority; | ||
} |
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
45 changes: 0 additions & 45 deletions
45
src/main/java/com/dnd/runus/infrastructure/persistence/jooq/badge/JooqBadgeRepository.java
This file was deleted.
Oops, something went wrong.
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
5 changes: 5 additions & 0 deletions
5
src/main/java/com/dnd/runus/presentation/v1/badge/dto/response/AchievedBadge.java
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,5 @@ | ||
package com.dnd.runus.presentation.v1.badge.dto.response; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
public record AchievedBadge(long badgeId, String name, String imageUrl, LocalDateTime achievedAt) {} |
8 changes: 0 additions & 8 deletions
8
src/main/java/com/dnd/runus/presentation/v1/badge/dto/response/AchievedBadgesResponse.java
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,16 +1,8 @@ | ||
package com.dnd.runus.presentation.v1.badge.dto.response; | ||
|
||
import java.time.LocalDateTime; | ||
import java.util.List; | ||
|
||
public record AchievedBadgesResponse( | ||
List<AchievedBadge> badges | ||
) { | ||
public record AchievedBadge( | ||
long badgeId, | ||
String name, | ||
String imageUrl, | ||
LocalDateTime achievedAt | ||
) { | ||
} | ||
} |
39 changes: 8 additions & 31 deletions
39
src/main/java/com/dnd/runus/presentation/v1/badge/dto/response/AllBadgesListResponse.java
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,41 +1,18 @@ | ||
package com.dnd.runus.presentation.v1.badge.dto.response; | ||
|
||
import com.dnd.runus.domain.badge.Badge; | ||
import com.dnd.runus.domain.badge.BadgeWithAchieveStatusAndAchievedAt; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import java.time.LocalDateTime; | ||
import java.util.List; | ||
|
||
public record AllBadgesListResponse( | ||
@Schema(description = "신규 뱃지 목록") | ||
List<BadgeWithAchievedStatus> recencyBadges, | ||
@Schema(description = "개인기록 뱃지 목록") | ||
List<BadgeWithAchievedStatus> personalBadges, | ||
@Schema(description = "러닝 거리 뱃지 목록") | ||
List<BadgeWithAchievedStatus> distanceBadges, | ||
@Schema(description = "연속 뱃지 목록") | ||
List<BadgeWithAchievedStatus> streakBadges, | ||
@Schema(description = "사간 뱃지 목록") | ||
List<BadgeWithAchievedStatus> durationBadges, | ||
@Schema(description = "레벨 뱃지 목록") | ||
List<BadgeWithAchievedStatus> levelBadges | ||
@Schema(description = "최신 뱃지 목록(일주일 기준), 없으면 빈리스트 리턴") | ||
List<AchievedBadge> recencyBadges, | ||
List<BadgesWithType> badgesList | ||
) { | ||
public record BadgeWithAchievedStatus( | ||
@Schema(description = "뱃지 id") | ||
long badgeId, | ||
@Schema(description = "뱃지 이름") | ||
String name, | ||
@Schema(description = "뱃지 이미지 url") | ||
String imageUrl, | ||
@Schema(description = "뱃지 달성 여부") | ||
boolean isAchieved, | ||
@Schema(description = "배지 달성 날짜") | ||
LocalDateTime achievedAt | ||
public record BadgesWithType( | ||
@Schema(description = "뱃지 카테고리 이름") | ||
String category, | ||
@Schema(description = "뱃지 리스트") | ||
List<AchievedBadge> badges | ||
) { | ||
public static BadgeWithAchievedStatus from( | ||
BadgeWithAchieveStatusAndAchievedAt badgeWithAchievedStatus) { | ||
Badge badge = badgeWithAchievedStatus.badge(); | ||
return new BadgeWithAchievedStatus(badge.badgeId(), badge.name(), badge.imageUrl(), badgeWithAchievedStatus.isAchieved(), badgeWithAchievedStatus.achievedAt()); | ||
} | ||
} | ||
} |
Oops, something went wrong.