Skip to content

Commit

Permalink
Merge pull request #462 from Travel-in-nanaland/feat/#453-reviewKeyword
Browse files Browse the repository at this point in the history
[Feat] 리뷰 키워드 필수 개수 수정 및 키워드 추가
  • Loading branch information
jyajoo authored Nov 20, 2024
2 parents 005bebf + 0acc9bf commit 8c6e81c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ public static class CreateReviewDto {
description = "게시물 카테고리",
example = "[\"ANNIVERSARY\", \"CUTE\", \"PET\" ]",
allowableValues = {"ANNIVERSARY", "CUTE", "LUXURY", "SCENERY", "KIND", "CHILDREN", "FRIEND",
"PARENTS", "ALONE", "HALF", "RELATIVE", "PET", "OUTLET", "LARGE", "BATHROOM"}
"PARENTS", "ALONE", "HALF", "RELATIVE", "PET", "OUTLET", "LARGE", "BATHROOM", "NONE"}
)
@Size(min = 3, message = "최소 3개 선택 가능합니다.")
@Size(min = 1, message = "최소 1개 선택 가능합니다.")
@Size(max = 6, message = "최대 6개까지 선택 가능합니다")
private List<String> reviewKeywords;

Expand Down Expand Up @@ -70,7 +70,7 @@ public static class EditReviewDto {
allowableValues = {"ANNIVERSARY", "CUTE", "LUXURY", "SCENERY", "KIND", "CHILDREN", "FRIEND",
"PARENTS", "ALONE", "HALF", "RELATIVE", "PET", "OUTLET", "LARGE", "BATHROOM"}
)
@Size(min = 3, message = "최소 3개 선택 가능합니다.")
@Size(min = 1, message = "최소 1개 선택 가능합니다.")
@Size(max = 6, message = "최대 6개까지 선택 가능합니다")
private List<String> reviewKeywords;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ public enum ReviewTypeKeyword {
OUTLET(Type.AMENITIES, "콘센트 사용 가능", "Outlet available", "提供电源插座", "Soket tersedia", "Có ổ cắm điện"),
LARGE(Type.AMENITIES, "넓은 장소", "Wide", "宽敞", "Luas", "Rộng rãi"),
PARK(Type.AMENITIES, "주차장", "Parking lot", "停车场", "Tempat letak kereta", "Bãi đậu xe"),
BATHROOM(Type.AMENITIES, "깨끗한 화장실", "Clean toilet", "洁净的卫生间", "Tandas bersih", "Nhà vệ sinh sạch sẽ");
BATHROOM(Type.AMENITIES, "깨끗한 화장실", "Clean toilet", "洁净的卫生间", "Tandas bersih", "Nhà vệ sinh sạch sẽ"),
NONE(Type.ETC, "", "", "", "", "");

private final Type type;
private final String kr;
Expand Down Expand Up @@ -52,6 +53,6 @@ public String getValueByLocale(Language language) {
}

public enum Type {
MOOD, COMPANION, AMENITIES
MOOD, COMPANION, AMENITIES, ETC
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,13 @@ public void saveReview(MemberInfoDto memberInfoDto, Long id, Category category,
throw new BadRequestException(REVIEW_KEYWORD_DUPLICATION.getMessage());
}

reviewKeywordStringSet.forEach(keyword ->
reviewKeywordRepository.save(ReviewKeyword.builder()
reviewKeywordStringSet.stream()
.map(ReviewTypeKeyword::valueOf)
.filter(keyword -> keyword != ReviewTypeKeyword.NONE)
.forEach(keyword -> reviewKeywordRepository.save(ReviewKeyword.builder()
.review(review)
.reviewTypeKeyword(ReviewTypeKeyword.valueOf(keyword))
.build())
);
.reviewTypeKeyword(keyword)
.build()));

// reviewImageFile
if (multipartFiles != null) {
Expand Down

0 comments on commit 8c6e81c

Please sign in to comment.