Skip to content

Commit

Permalink
Merge pull request #32 from Guzzing/features/review
Browse files Browse the repository at this point in the history
Fix: 리뷰 항목 누락 건 추가
  • Loading branch information
onetuks authored Nov 8, 2023
2 parents 530af8d + fbfab9d commit 69c57f0
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ public record ReviewPostRequest(
boolean cheapFee,
boolean goodFacility,
boolean goodManagement,
boolean lovelyTeaching
boolean lovelyTeaching,
boolean shuttleAvailability
) {

public static ReviewPostParam to(final Long memberId, final ReviewPostRequest request) {
Expand All @@ -20,7 +21,8 @@ public static ReviewPostParam to(final Long memberId, final ReviewPostRequest re
request.cheapFee(),
request.goodFacility(),
request.goodManagement(),
request.lovelyTeaching()
request.lovelyTeaching(),
request.shuttleAvailability()
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ public enum ReviewType {
GOOD_FACILITY,
CHEAP_FEE,
GOOD_MANAGEMENT,
LOVELY_TEACHING;
LOVELY_TEACHING,
SHUTTLE_AVAILABILITY;

private static final int MAX_REVIEW_COUNT = 3;

Expand All @@ -26,6 +27,7 @@ public static Map<ReviewType, Boolean> getSelectedReviewMap(final ReviewPostPara
selectedReviewMap.put(ReviewType.CHEAP_FEE, reviewPostParam.cheapFee());
selectedReviewMap.put(ReviewType.GOOD_MANAGEMENT, reviewPostParam.goodManagement());
selectedReviewMap.put(ReviewType.LOVELY_TEACHING, reviewPostParam.lovelyTeaching());
selectedReviewMap.put(ReviewType.SHUTTLE_AVAILABILITY, reviewPostParam.shuttleAvailability());

validateThreeReviewLimit(selectedReviewMap);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ public record ReviewPostParam(
boolean cheapFee,
boolean goodFacility,
boolean goodManagement,
boolean lovelyTeaching
boolean lovelyTeaching,
boolean shuttleAvailability
) {

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.springframework.test.context.ActiveProfiles;
import org.springframework.transaction.annotation.Transactional;

@ActiveProfiles(profiles = {"dev", "oauth"})
@ActiveProfiles(profiles = {"dev", "oauth", "test"})
@SpringBootTest
@Transactional
class LikeServiceTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ void registerReview_Success() throws Exception {
fieldWithPath("cheapFee").type(BOOLEAN).description("수강료가 싸요 리뷰 선택 여부"),
fieldWithPath("goodFacility").type(BOOLEAN).description("시설이 좋아요 리뷰 선택 여부"),
fieldWithPath("goodManagement").type(BOOLEAN).description("관리가 좋아요 리뷰 선택 여부"),
fieldWithPath("lovelyTeaching").type(BOOLEAN).description("가르침이 사랑스러워요 리뷰 선택 여부")
fieldWithPath("lovelyTeaching").type(BOOLEAN).description("가르침이 사랑스러워요 리뷰 선택 여부"),
fieldWithPath("shuttleAvailability").type(BOOLEAN).description("셔틀을 운행해요 리뷰 선택 여부")
),
responseFields(
fieldWithPath("reviewId").type(NUMBER).description("리뷰 아이디"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import static org.guzzing.studayserver.domain.review.model.ReviewType.GOOD_MANAGEMENT;
import static org.guzzing.studayserver.domain.review.model.ReviewType.KINDNESS;
import static org.guzzing.studayserver.domain.review.model.ReviewType.LOVELY_TEACHING;
import static org.guzzing.studayserver.domain.review.model.ReviewType.SHUTTLE_AVAILABILITY;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
Expand Down Expand Up @@ -32,7 +33,8 @@ public static ReviewPostRequest makeReviewPostRequest(boolean isValid) {
reviewMap.get(CHEAP_FEE),
reviewMap.get(GOOD_FACILITY),
reviewMap.get(GOOD_MANAGEMENT),
reviewMap.get(LOVELY_TEACHING));
reviewMap.get(LOVELY_TEACHING),
reviewMap.get(SHUTTLE_AVAILABILITY));
}

public static Map<ReviewType, Boolean> makeInvalidReviewMap() {
Expand All @@ -43,6 +45,7 @@ public static Map<ReviewType, Boolean> makeInvalidReviewMap() {
invalidReviewMap.put(GOOD_FACILITY, true);
invalidReviewMap.put(GOOD_MANAGEMENT, false);
invalidReviewMap.put(LOVELY_TEACHING, true);
invalidReviewMap.put(SHUTTLE_AVAILABILITY, false);

return invalidReviewMap;
}
Expand All @@ -55,6 +58,7 @@ public static Map<ReviewType, Boolean> makeValidReviewMap() {
validReviewMap.put(GOOD_FACILITY, false);
validReviewMap.put(GOOD_MANAGEMENT, false);
validReviewMap.put(LOVELY_TEACHING, true);
validReviewMap.put(SHUTTLE_AVAILABILITY, false);

return validReviewMap;
}
Expand Down

0 comments on commit 69c57f0

Please sign in to comment.