Skip to content

Commit d53c9c2

Browse files
authored
Merge pull request #71 from Nexters/feat/additional-feature
feat: add gym level field to route mission
2 parents 00d5dee + 5f11176 commit d53c9c2

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

src/main/java/com/climbup/climbup/recommendation/dto/response/RouteMissionRecommendationResponse.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.climbup.climbup.attempt.dto.response.UserMissionAttemptResponse;
44
import com.climbup.climbup.attempt.entity.UserMissionAttempt;
55
import com.climbup.climbup.gym.entity.ClimbingGym;
6+
import com.climbup.climbup.gym.dto.response.GymLevelResponse;
67
import com.climbup.climbup.recommendation.entity.ChallengeRecommendation;
78
import com.climbup.climbup.route.entity.RouteMission;
89
import com.climbup.climbup.sector.dto.SectorResponse;
@@ -31,6 +32,9 @@ public class RouteMissionRecommendationResponse {
3132
@Schema(description = "섹터 데이터")
3233
private SectorResponse sector;
3334

35+
@Schema(description = "암장 난이도")
36+
private GymLevelResponse gymLevel;
37+
3438
@Schema(description = "루트미션 난이도", example = "BLUE")
3539
private String difficulty;
3640

@@ -59,6 +63,7 @@ public static RouteMissionRecommendationResponse toDto(ChallengeRecommendation r
5963
.attempts(attempts.stream().map(UserMissionAttemptResponse::toDto).toList())
6064
.sector(SectorResponse.toDto(sector))
6165
.difficulty(recommendation.getDifficulty())
66+
.gymLevel(GymLevelResponse.fromEntity(mission.getGymLevel()))
6267
.score(mission.getScore())
6368
.imageUrl(mission.getImageUrl())
6469
.videoUrl(mission.getVideoUrl())

src/main/java/com/climbup/climbup/route/dto/response/RouteMissionListResponse.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.climbup.climbup.route.dto.response;
22

3+
import com.climbup.climbup.gym.dto.response.GymLevelResponse;
34
import com.climbup.climbup.route.entity.RouteMission;
45
import com.fasterxml.jackson.annotation.JsonFormat;
56
import io.swagger.v3.oas.annotations.media.Schema;
@@ -25,6 +26,9 @@ public class RouteMissionListResponse {
2526
@Schema(description = "난이도", example = "BLUE")
2627
private String difficulty;
2728

29+
@Schema(description = "암장 난이도")
30+
private GymLevelResponse gymLevel;
31+
2832
@Schema(description = "점수", example = "100")
2933
private Integer score;
3034

@@ -44,6 +48,7 @@ public static RouteMissionListResponse from(RouteMission mission) {
4448
.gymName(mission.getGym().getName())
4549
.sectorName(mission.getSector().getName())
4650
.difficulty(mission.getDifficulty())
51+
.gymLevel(GymLevelResponse.fromEntity(mission.getGymLevel()))
4752
.score(mission.getScore())
4853
.imageUrl(mission.getImageUrl())
4954
.thumbnailUrl(mission.getThumbnailUrl())

src/main/java/com/climbup/climbup/route/entity/RouteMission.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
import com.climbup.climbup.attempt.entity.UserMissionAttempt;
44
import com.climbup.climbup.common.entity.BaseEntity;
55
import com.climbup.climbup.gym.entity.ClimbingGym;
6+
import com.climbup.climbup.gym.entity.GymLevel;
67
import com.climbup.climbup.recommendation.entity.ChallengeRecommendation;
78
import com.climbup.climbup.sector.entity.Sector;
89
import jakarta.persistence.*;
910
import lombok.*;
1011
import lombok.experimental.SuperBuilder;
1112

12-
import java.time.Duration;
1313
import java.time.LocalDateTime;
1414
import java.util.ArrayList;
1515
import java.util.List;
@@ -40,6 +40,10 @@ public class RouteMission extends BaseEntity {
4040
@Column(name = "score", nullable = false)
4141
private Integer score;
4242

43+
@ManyToOne(fetch = FetchType.LAZY)
44+
@JoinColumn(name = "gym_level_id", nullable = false)
45+
private GymLevel gymLevel;
46+
4347
@Column(name = "image_url", nullable = false, columnDefinition = "TEXT")
4448
private String imageUrl;
4549

0 commit comments

Comments
 (0)