Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CICD 테스트 #47

Merged
merged 1 commit into from
Oct 9, 2024
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
21 changes: 18 additions & 3 deletions src/main/java/team7/inplace/place/application/PlaceService.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,26 @@ private Page<Place> getPlacesByDistance(
List<String> influencerFilters
) {
return placeRepository.getPlacesByDistanceAndFilters(
placesCoordinateCommand.latitude(),
placesCoordinateCommand.topLeftLongitude(),
placesCoordinateCommand.topLeftLatitude(),
placesCoordinateCommand.bottomRightLongitude(),
placesCoordinateCommand.bottomRightLatitude(),
placesCoordinateCommand.longitude(),
placesCoordinateCommand.latitude(),
categoryFilters,
influencerFilters,
placesCoordinateCommand.pageable());
placesCoordinateCommand.pageable()
);
}

public PlaceDetailInfo getPlaceDetailInfo(Long placeId) {
Place place = placeRepository.findById(placeId)
.orElseThrow(() -> new IllegalArgumentException("PlaceService.getPlaceDetailInfo(): "
+ "Place Id가 존재하지 않습니다."));
Video video = videoRepository.findByPlaceId(placeId)
.orElseThrow(() -> new IllegalArgumentException("PlaceService.getPlaceDetailInfo(): "
+ "Place Id가 존재하지 않습니다."));
return PlaceDetailInfo.from(place, video.getInfluencer(), video);
}

public List<Long> createPlaces(List<Create> placeCommands) {
Expand Down Expand Up @@ -114,4 +129,4 @@ public List<Long> createPlaces(List<Create> placeCommands) {

return savedPlacesId;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@
public class PlacesCommand {

public record PlacesCoordinateCommand(
String topLeftLongitude,
String topLeftLatitude,
String bottomRightLongitude,
String bottomRightLatitude,
String longitude,
String latitude,
Pageable pageable
) {

}

public record PlacesFilterParamsCommand(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@
import team7.inplace.video.domain.Video;

public record PlaceDetailInfo(
PlaceInfo placeInfo,
JsonNode facilityInfo,
MenuInfos menuInfos,
OpenHour openHour,
PlaceLikes placeLikes,
String videoUrl
PlaceInfo placeInfo,
JsonNode facilityInfo,
MenuInfos menuInfos,
OpenHour openHour,
PlaceLikes placeLikes,
String videoUrl
) {

public static PlaceDetailInfo from(Place place, Influencer influencer, Video video) {
return new PlaceDetailInfo(
PlaceInfo.of(place, influencer.getName()),
facilityTree(place.getFacility()),
MenuInfos.of(place.getMenus()),
OpenHour.of(place.getOpenPeriods(), place.getOffDays()),
PlaceLikes.of(null), //추후 추가 예정
video.getVideoUrl()
PlaceInfo.of(place, influencer.getName()),
facilityTree(place.getFacility()),
MenuInfos.of(place.getMenus()),
OpenHour.of(place.getOpenPeriods(), place.getOffDays()),
PlaceLikes.of(null), //추후 추가 예정
video.getVideoUrl()
);
}

Expand All @@ -41,72 +41,73 @@ private static JsonNode facilityTree(String facility) {


public record MenuInfos(
List<String> menuImgUrls,
List<MenuInfo> menuList,
LocalDateTime timeExp
List<String> menuImgUrls,
List<MenuInfo> menuList,
LocalDateTime timeExp
) {

public static MenuInfos of(List<Menu> menus) {
List<String> menuImgUrls = menus.stream()
.map(Menu::getMenuImgUrl) // 메뉴 이미지 URL을 추출
.toList();
.map(Menu::getMenuImgUrl) // 메뉴 이미지 URL을 추출
.toList();

List<MenuInfo> menuList = menus.stream()
.map(menu -> new MenuInfo(menu.getPrice().intValue(), menu.isRecommend(),
menu.getMenuName()))
.toList();
.map(menu -> new MenuInfo(menu.getPrice().intValue(), menu.isRecommend(),
menu.getMenuName()))
.toList();

return new MenuInfos(menuImgUrls, menuList, LocalDateTime.now());
}

public record MenuInfo(
Integer price,
Boolean recommend,
String menuName
Integer price,
Boolean recommend,
String menuName
) {

}
}

public record OpenHour(
List<Period> periodList,
List<OffDay> offdayList
List<Period> periodList,
List<OffDay> offdayList
) {

public static OpenHour of(List<OpenTime> openTimes,
List<team7.inplace.place.domain.OffDay> closeTimes) {
List<team7.inplace.place.domain.OffDay> closeTimes
) {
List<Period> periods = openTimes.stream()
.map(time -> new Period(time.getTimeName(), time.getTimeSE(), time.getDayOfWeek()))
.toList();
.map(time -> new Period(time.getTimeName(), time.getTimeSE(), time.getDayOfWeek()))
.toList();

List<OffDay> offDays = closeTimes.stream()
.map(closeTime -> new OffDay(closeTime.getHolidayName(), closeTime.getWeekAndDay(),
closeTime.getTemporaryHolidays()))
.toList();
.map(closeTime -> new OffDay(closeTime.getHolidayName(), closeTime.getWeekAndDay(),
closeTime.getTemporaryHolidays()))
.toList();

return new OpenHour(periods, offDays);
}

public record Period(
String timeName,
String timeSE,
String dayOfWeek
String timeName,
String timeSE,
String dayOfWeek
) {

}

public record OffDay(
String holidayName,
String weekAndDay,
String temporaryHolidays
String holidayName,
String weekAndDay,
String temporaryHolidays
) {

}
}

public record PlaceLikes(
Integer like,
Integer dislike
Integer like,
Integer dislike
) {

public static PlaceLikes of(Boolean likes) {
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/team7/inplace/place/domain/Menu.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ public class Menu {
@Column(length = 50, nullable = false)
private String menuName;

@Column(length = 50)
private String menuImgUrl;

private Menu(Long price, boolean recommend, String menuName) {
this.price = price;
this.recommend = recommend;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/team7/inplace/place/domain/OffDay.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class OffDay {
private String temporaryHolidays;

private OffDay(String holydayName, String weekAndDay, String temporaryHolidays) {
this.holydayName = holydayName;
this.holidayName = holydayName;
this.weekAndDay = weekAndDay;
this.temporaryHolidays = temporaryHolidays;
}
Expand Down
Loading