Skip to content

Commit

Permalink
Merge pull request #93 from OurMenu/feat/develop
Browse files Browse the repository at this point in the history
Fix : feat/develop
  • Loading branch information
csh-scl authored Aug 15, 2024
2 parents e645eca + 62fc4a4 commit 2a0b4d4
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public class MenuDetailDto {
private String menuMemoTitle;
private String menuMemo;
private String menuIconType;
private PlaceInfoDTO menuPlaceInfo;
private List<TagDTO> menuTags;
private List<MenuImageDto> menuImages; // 이미지 리스트
private List<PlaceMenuFolderDTO> menuFolders; // 메뉴 폴더 리스트
Expand All @@ -45,8 +46,6 @@ public static MenuDetailDto toDto(List<Menu> menus) {
return menuDetailDto;
}



private static MenuDetailDto fromMenu(Menu menu, List<PlaceMenuFolderDTO> menuFolders) {
log.info("e" + menu.getMemoTitle());
List<TagDTO> tagDTOs = menu.getTags().stream() // MenuTag 리스트로부터 스트림 생성
Expand All @@ -57,6 +56,8 @@ private static MenuDetailDto fromMenu(Menu menu, List<PlaceMenuFolderDTO> menuFo
.map(img -> new MenuImageDto(img.getUrl())) // 이미지 DTO 변환
.collect(Collectors.toList());

// Place 정보 생성
PlaceInfoDTO placeInfoDTO = PlaceInfoDTO.toDto(menu.getPlace());


return MenuDetailDto.builder()
Expand All @@ -69,6 +70,7 @@ private static MenuDetailDto fromMenu(Menu menu, List<PlaceMenuFolderDTO> menuFo
.menuTags(tagDTOs) // 태그 리스트 추가
.menuImages(imageDTOs) // 이미지 리스트 추가
.menuFolders(menuFolders)
.menuPlaceInfo(placeInfoDTO)
.build();
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package com.ourMenu.backend.domain.menu.dto.response;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ourMenu.backend.domain.menu.domain.Menu;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
Expand All @@ -23,7 +25,8 @@ public class MenuDto {
private int menuPrice;
private String menuImgUrl;


@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss")
private LocalDateTime createdAt;

public static List<MenuDto> toDto(List<Menu> menus) {
List<MenuDto> dtoList = new ArrayList<>();
Expand Down Expand Up @@ -56,6 +59,7 @@ private static MenuDto fromMenu(Menu menu) {
.placeAddress(menu.getPlace().getAddress())
.menuPrice(menu.getPrice())
.groupId(menu.getGroupId())
.createdAt(menu.getCreatedAt())
.menuImgUrl(menu.getImages().isEmpty() ? null : menu.getImages().get(0).getUrl())
.build();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.ourMenu.backend.domain.menu.dto.response;

import com.ourMenu.backend.domain.menu.domain.Place;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;

@Data
@Builder
public class PlaceInfoDTO {
private String placeAddress;
private String placeInfo;

public static PlaceInfoDTO toDto(Place place){
return PlaceInfoDTO.builder()
.placeAddress(place.getAddress())
.placeInfo(place.getInfo())
.build();
}
}

0 comments on commit 2a0b4d4

Please sign in to comment.