From 0701ecdc9c7bc51eb1bf70ce08fcb7bef6948874 Mon Sep 17 00:00:00 2001 From: imenuuu Date: Wed, 6 Nov 2024 20:49:29 +0900 Subject: [PATCH] =?UTF-8?q?refactor=20:=20=ED=96=A5=20=ED=82=A4=EC=9B=8C?= =?UTF-8?q?=EB=93=9C=20=EC=A7=81=EC=A0=91=EC=9E=85=EB=A0=A5=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../convertor/TastingNoteConvertor.java | 21 ++++++++++++++----- .../tastingNote/dto/TastingNoteResponse.java | 2 ++ 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/Winey-API/src/main/java/com/example/wineyapi/tastingNote/convertor/TastingNoteConvertor.java b/Winey-API/src/main/java/com/example/wineyapi/tastingNote/convertor/TastingNoteConvertor.java index 52fffb6..23677ed 100644 --- a/Winey-API/src/main/java/com/example/wineyapi/tastingNote/convertor/TastingNoteConvertor.java +++ b/Winey-API/src/main/java/com/example/wineyapi/tastingNote/convertor/TastingNoteConvertor.java @@ -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)) @@ -337,6 +338,18 @@ public TastingNoteResponse.TastingNoteDTO toTastingNote(TastingNote tastingNote, .build(); } + private List toDirectKeywordList(List smellKeywordTastingNotes) { + List directKeywordList = new ArrayList<>(); + + for(SmellKeywordTastingNote smellKeywordTastingNote : smellKeywordTastingNotes){ + if(smellKeywordTastingNote.getDirectYN().equals("Y")){ + directKeywordList.add(smellKeywordTastingNote.getSmellKeyword()); + } + } + + return directKeywordList; + } + private List toTastingNoteImageRes(List tastingNoteImages) { List tastingNoteImageList = new ArrayList<>(); @@ -371,13 +384,11 @@ private TastingNoteResponse.MyWineTaste MyWineTaste(TastingNote tastingNote) { .build(); } - private List SmellKeywordList(List smellKeywordTastingNotes) { + private List toSmellKeywordList(List smellKeywordTastingNotes) { List 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()); } } diff --git a/Winey-API/src/main/java/com/example/wineyapi/tastingNote/dto/TastingNoteResponse.java b/Winey-API/src/main/java/com/example/wineyapi/tastingNote/dto/TastingNoteResponse.java index dceae36..cbffc31 100644 --- a/Winey-API/src/main/java/com/example/wineyapi/tastingNote/dto/TastingNoteResponse.java +++ b/Winey-API/src/main/java/com/example/wineyapi/tastingNote/dto/TastingNoteResponse.java @@ -116,6 +116,8 @@ public static class TastingNoteDTO { private List smellKeywordList; + private List directKeywordList; + @Schema(description = "내가 느낀 와인의 맛") private MyWineTaste myWineTaste;