Skip to content

Commit

Permalink
refactor : 향 키워드 직접입력 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
imenuuu committed Nov 6, 2024
1 parent 8d97b12 commit 0701ecd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,8 @@ public TastingNoteResponse.TastingNoteDTO toTastingNote(TastingNote tastingNote,
.varietal(wine.getVarietal())
.price(tastingNote.getPrice())
.officialAlcohol(tastingNote.getOfficialAlcohol())
.smellKeywordList(SmellKeywordList(smellKeywordTastingNotes))
.smellKeywordList(toSmellKeywordList(smellKeywordTastingNotes))
.directKeywordList(toDirectKeywordList(smellKeywordTastingNotes))
.myWineTaste(MyWineTaste(tastingNote))
.defaultWineTaste(DefaultWineTaste(wine))
.tastingNoteImage(toTastingNoteImageRes(tastingNoteImages))
Expand All @@ -337,6 +338,18 @@ public TastingNoteResponse.TastingNoteDTO toTastingNote(TastingNote tastingNote,
.build();
}

private List<String> toDirectKeywordList(List<SmellKeywordTastingNote> smellKeywordTastingNotes) {
List<String> directKeywordList = new ArrayList<>();

for(SmellKeywordTastingNote smellKeywordTastingNote : smellKeywordTastingNotes){
if(smellKeywordTastingNote.getDirectYN().equals("Y")){
directKeywordList.add(smellKeywordTastingNote.getSmellKeyword());
}
}

return directKeywordList;
}

private List<TastingNoteResponse.TastingNoteImage> toTastingNoteImageRes(List<TastingNoteImage> tastingNoteImages) {
List<TastingNoteResponse.TastingNoteImage> tastingNoteImageList = new ArrayList<>();

Expand Down Expand Up @@ -371,13 +384,11 @@ private TastingNoteResponse.MyWineTaste MyWineTaste(TastingNote tastingNote) {
.build();
}

private List<String> SmellKeywordList(List<SmellKeywordTastingNote> smellKeywordTastingNotes) {
private List<String> toSmellKeywordList(List<SmellKeywordTastingNote> smellKeywordTastingNotes) {
List<String> smellKeywordList = new ArrayList<>();

for(SmellKeywordTastingNote smellKeywordTastingNote : smellKeywordTastingNotes){
if(smellKeywordTastingNote.getDirectYN().equals("Y")){
smellKeywordList.add(smellKeywordTastingNote.getSmellKeyword());
}else {
if(smellKeywordTastingNote.getDirectYN().equals("N")){
smellKeywordList.add(SmellKeyword.findByValue(smellKeywordTastingNote.getSmellKeyword()).getValue());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ public static class TastingNoteDTO {

private List<String> smellKeywordList;

private List<String> directKeywordList;

@Schema(description = "내가 느낀 와인의 맛")
private MyWineTaste myWineTaste;

Expand Down

0 comments on commit 0701ecd

Please sign in to comment.