Skip to content

Commit 78b4720

Browse files
authored
Merge pull request #251 from prgrms-web-devcourse-final-project/feat#250
[feat] 나만의 bar: 칵테일 한글이름, 알콜도수 라벨이 출력되도록 필드 추가 #250
2 parents ec11ade + fdcc97e commit 78b4720

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/main/java/com/back/domain/mybar/dto/MyBarItemResponseDto.java

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

3+
import com.back.domain.cocktail.enums.AlcoholStrength;
34
import com.back.domain.mybar.entity.MyBar;
45
import lombok.Builder;
56
import lombok.Getter;
@@ -12,6 +13,8 @@ public class MyBarItemResponseDto {
1213
private Long id;
1314
private Long cocktailId;
1415
private String cocktailName;
16+
private String cocktailNameKo; // 칵테일의 한글 표기 이름
17+
private AlcoholStrength alcoholStrength; // 도수 레이블로 쓰이는 알코올 강도
1518
private String imageUrl;
1619
private LocalDateTime createdAt;
1720
private LocalDateTime keptAt;
@@ -21,6 +24,8 @@ public static MyBarItemResponseDto from(MyBar m) {
2124
.id(m.getId())
2225
.cocktailId(m.getCocktail().getId())
2326
.cocktailName(m.getCocktail().getCocktailName())
27+
.cocktailNameKo(m.getCocktail().getCocktailNameKo())
28+
.alcoholStrength(m.getCocktail().getAlcoholStrength())
2429
.imageUrl(m.getCocktail().getCocktailImgUrl())
2530
.createdAt(m.getCreatedAt())
2631
.keptAt(m.getKeptAt())

src/test/java/com/back/domain/mybar/controller/MyBarControllerTest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.back.domain.mybar.controller;
22

3+
import com.back.domain.cocktail.enums.AlcoholStrength;
34
import com.back.domain.mybar.dto.MyBarItemResponseDto;
45
import com.back.domain.mybar.dto.MyBarListResponseDto;
56
import com.back.domain.mybar.service.MyBarService;
@@ -105,6 +106,8 @@ void getMyBarList_withoutCursor() throws Exception {
105106
.id(3L)
106107
.cocktailId(10L)
107108
.cocktailName("Margarita")
109+
.cocktailNameKo("留덇?由ы?")
110+
.alcoholStrength(AlcoholStrength.LIGHT)
108111
.imageUrl("https://example.com/margarita.jpg")
109112
.createdAt(createdAt)
110113
.keptAt(keptAt)
@@ -133,6 +136,8 @@ void getMyBarList_withoutCursor() throws Exception {
133136
.andExpect(jsonPath("$.data.items[0].id").value(3L))
134137
.andExpect(jsonPath("$.data.items[0].cocktailId").value(10L))
135138
.andExpect(jsonPath("$.data.items[0].cocktailName").value("Margarita"))
139+
.andExpect(jsonPath("$.data.items[0].cocktailNameKo").value("留덇?由ы?"))
140+
.andExpect(jsonPath("$.data.items[0].alcoholStrength").value("LIGHT"))
136141
.andExpect(jsonPath("$.data.items[0].imageUrl").value("https://example.com/margarita.jpg"))
137142
.andExpect(jsonPath("$.data.items[0].createdAt").value(ISO_WITH_SECONDS.format(createdAt)))
138143
.andExpect(jsonPath("$.data.items[0].keptAt").value(ISO_WITH_SECONDS.format(keptAt)))
@@ -160,6 +165,8 @@ void getMyBarList_withCursor() throws Exception {
160165
.id(20L)
161166
.cocktailId(33L)
162167
.cocktailName("Negroni")
168+
.cocktailNameKo("?ㅺ렇濡쒕땲")
169+
.alcoholStrength(AlcoholStrength.STRONG)
163170
.imageUrl("https://example.com/negroni.jpg")
164171
.createdAt(itemCreatedAt)
165172
.keptAt(itemKeptAt)
@@ -190,6 +197,8 @@ void getMyBarList_withCursor() throws Exception {
190197
.andExpect(jsonPath("$.message").value("success"))
191198
.andExpect(jsonPath("$.data.items[0].id").value(20L))
192199
.andExpect(jsonPath("$.data.items[0].cocktailName").value("Negroni"))
200+
.andExpect(jsonPath("$.data.items[0].cocktailNameKo").value("?ㅺ렇濡쒕땲"))
201+
.andExpect(jsonPath("$.data.items[0].alcoholStrength").value("STRONG"))
193202
.andExpect(jsonPath("$.data.hasNext").value(false))
194203
.andExpect(jsonPath("$.data.nextKeptAt").doesNotExist());
195204

0 commit comments

Comments
 (0)