Skip to content

Commit eb3743f

Browse files
authored
Merge pull request #251 from GTable/refoctor#250-admin-menuName
Refoctor: 관리자용 메뉴 이름 추가
2 parents 887c367 + 56b981e commit eb3743f

6 files changed

Lines changed: 18 additions & 2 deletions

File tree

nowait-app-admin-api/src/main/java/com/nowait/applicationadmin/menu/dto/MenuCreateRequest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ public class MenuCreateRequest {
1616
@NotNull
1717
private Long storeId;
1818
@NotNull
19+
private String adminDisplayName;
20+
@NotNull
1921
private String name;
2022
@NotNull
2123
private String description;
@@ -25,6 +27,7 @@ public class MenuCreateRequest {
2527
public Menu toEntity() {
2628
return Menu.builder()
2729
.storeId(storeId)
30+
.adminDisplayName(adminDisplayName != null ? adminDisplayName : name)
2831
.name(name)
2932
.description(description)
3033
.price(price)

nowait-app-admin-api/src/main/java/com/nowait/applicationadmin/menu/dto/MenuCreateResponse.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import com.nowait.domaincorerdb.menu.entity.Menu;
66

7+
import jakarta.validation.constraints.NotNull;
78
import lombok.AllArgsConstructor;
89
import lombok.Builder;
910
import lombok.Getter;
@@ -14,6 +15,7 @@
1415
public class MenuCreateResponse {
1516
private Long menuId;
1617
private Long storeId;
18+
private String adminDisplayName;
1719
private String name;
1820
private String description;
1921
private Integer price;
@@ -26,6 +28,7 @@ public static MenuCreateResponse fromEntity(Menu menu) {
2628
.createdAt(menu.getCreatedAt())
2729
.menuId(menu.getId())
2830
.storeId(menu.getStoreId())
31+
.adminDisplayName(menu.getAdminDisplayName())
2932
.name(menu.getName())
3033
.description(menu.getDescription())
3134
.price(menu.getPrice())

nowait-app-admin-api/src/main/java/com/nowait/applicationadmin/menu/dto/MenuReadDto.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import com.nowait.domaincorerdb.menu.entity.Menu;
66

7+
import jakarta.validation.constraints.NotNull;
78
import lombok.AllArgsConstructor;
89
import lombok.Builder;
910
import lombok.Getter;
@@ -14,6 +15,7 @@
1415
public class MenuReadDto {
1516
private Long menuId;
1617
private Long storeId;
18+
private String adminDisplayName;
1719
private String name;
1820
private String description;
1921
private Integer price;
@@ -25,6 +27,7 @@ public static MenuReadDto fromEntity(Menu menu, List<MenuImageUploadResponse> im
2527
return MenuReadDto.builder()
2628
.menuId(menu.getId())
2729
.storeId(menu.getStoreId())
30+
.adminDisplayName(menu.getAdminDisplayName())
2831
.name(menu.getName())
2932
.description(menu.getDescription())
3033
.price(menu.getPrice())

nowait-app-admin-api/src/main/java/com/nowait/applicationadmin/menu/dto/MenuUpdateRequest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
@NoArgsConstructor
1111
@Builder
1212
public class MenuUpdateRequest {
13+
private String adminDisplayName;
1314
private String name;
1415
private String description;
1516
private Integer price;

nowait-app-admin-api/src/main/java/com/nowait/applicationadmin/menu/service/MenuService.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ public MenuReadDto updateMenu(Long menuId, MenuUpdateRequest request, MemberDeta
107107
}
108108

109109
menu.updateInfo(
110+
request.getAdminDisplayName(),
110111
request.getName(),
111112
request.getDescription(),
112113
request.getPrice()

nowait-domain/domain-core-rdb/src/main/java/com/nowait/domaincorerdb/menu/entity/Menu.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ public class Menu extends BaseTimeEntity {
3131
@Column(nullable = false)
3232
private Long storeId;
3333

34+
@Column(nullable = true)
35+
private String adminDisplayName;
36+
3437
@Column(nullable = false)
3538
private String name;
3639

@@ -47,18 +50,20 @@ public class Menu extends BaseTimeEntity {
4750
private Boolean deleted;
4851

4952

50-
public Menu(LocalDateTime createdAt, Long id, Long storeId, String name, String description, Integer price, Boolean isSoldOut, Boolean deleted) {
53+
public Menu(LocalDateTime createdAt, Long id, Long storeId, String adminDisplayName, String name, String description, Integer price, Boolean isSoldOut, Boolean deleted) {
5154
super(createdAt);
5255
this.Id = id;
5356
this.storeId = storeId;
57+
this.adminDisplayName = adminDisplayName;
5458
this.name = name;
5559
this.description = description;
5660
this.price = price;
5761
this.isSoldOut = isSoldOut != null ? isSoldOut : false;
5862
this.deleted = deleted != null ? deleted : false;
5963
}
6064

61-
public void updateInfo(String name, String description, Integer price) {
65+
public void updateInfo(String adminDisplayName, String name, String description, Integer price) {
66+
if (adminDisplayName != null) this.adminDisplayName = adminDisplayName;
6267
if (name != null) this.name = name;
6368
if (description != null) this.description = description;
6469
if (price != null) this.price = price;

0 commit comments

Comments
 (0)