Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ public class MenuCreateRequest {
@NotNull
private Long storeId;
@NotNull
private String adminDisplayName;
@NotNull
private String name;
@NotNull
private String description;
Expand All @@ -25,6 +27,7 @@ public class MenuCreateRequest {
public Menu toEntity() {
return Menu.builder()
.storeId(storeId)
.adminDisplayName(adminDisplayName != null ? adminDisplayName : name)
.name(name)
.description(description)
.price(price)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

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

import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
Expand All @@ -14,6 +15,7 @@
public class MenuCreateResponse {
private Long menuId;
private Long storeId;
private String adminDisplayName;
private String name;
private String description;
private Integer price;
Expand All @@ -26,6 +28,7 @@ public static MenuCreateResponse fromEntity(Menu menu) {
.createdAt(menu.getCreatedAt())
.menuId(menu.getId())
.storeId(menu.getStoreId())
.adminDisplayName(menu.getAdminDisplayName())
.name(menu.getName())
.description(menu.getDescription())
.price(menu.getPrice())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

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

import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
Expand All @@ -14,6 +15,7 @@
public class MenuReadDto {
private Long menuId;
private Long storeId;
private String adminDisplayName;
private String name;
private String description;
private Integer price;
Expand All @@ -25,6 +27,7 @@ public static MenuReadDto fromEntity(Menu menu, List<MenuImageUploadResponse> im
return MenuReadDto.builder()
.menuId(menu.getId())
.storeId(menu.getStoreId())
.adminDisplayName(menu.getAdminDisplayName())
.name(menu.getName())
.description(menu.getDescription())
.price(menu.getPrice())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
@NoArgsConstructor
@Builder
public class MenuUpdateRequest {
private String adminDisplayName;
private String name;
private String description;
private Integer price;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ public MenuReadDto updateMenu(Long menuId, MenuUpdateRequest request, MemberDeta
}

menu.updateInfo(
request.getAdminDisplayName(),
request.getName(),
request.getDescription(),
request.getPrice()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ public class Menu extends BaseTimeEntity {
@Column(nullable = false)
private Long storeId;

@Column(nullable = true)
private String adminDisplayName;

@Column(nullable = false)
private String name;

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


public Menu(LocalDateTime createdAt, Long id, Long storeId, String name, String description, Integer price, Boolean isSoldOut, Boolean deleted) {
public Menu(LocalDateTime createdAt, Long id, Long storeId, String adminDisplayName, String name, String description, Integer price, Boolean isSoldOut, Boolean deleted) {
super(createdAt);
this.Id = id;
this.storeId = storeId;
this.adminDisplayName = adminDisplayName;
this.name = name;
this.description = description;
this.price = price;
this.isSoldOut = isSoldOut != null ? isSoldOut : false;
this.deleted = deleted != null ? deleted : false;
}

public void updateInfo(String name, String description, Integer price) {
public void updateInfo(String adminDisplayName, String name, String description, Integer price) {
if (adminDisplayName != null) this.adminDisplayName = adminDisplayName;
if (name != null) this.name = name;
if (description != null) this.description = description;
if (price != null) this.price = price;
Expand Down