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 @@ -2,10 +2,9 @@

import devkor.com.teamcback.domain.koyeon.entity.FreePub;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.ArrayList;
import java.util.List;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.List;

@Schema(description = "주점 정보")
@Getter
Expand All @@ -24,18 +23,10 @@ public class SearchFreePubRes {
private Double latitude;
@Schema(description = "노드 ID", example = "1")
private Long nodeId = null;
@Schema(description = "주점 주소", example = "서울특별시 성북구 5가")
private String address;
@Schema(description = "태그에 해당하는 음식 리스트", example = "[\"떡볶이\"]")
private List<String> filteredMenus = new ArrayList<>();

public SearchFreePubRes(FreePub pub) {
this.id = pub.getId();
this.name = pub.getName();
this.sponsor = pub.getSponsor();
this.operatingTime = pub.getOperatingTime();
this.latitude = pub.getLatitude();
this.longitude = pub.getLongitude();
if(pub.getNode() != null) this.nodeId = pub.getNode().getId();
}
private List<String> filteredMenus;

public SearchFreePubRes(FreePub pub, List<String> filteredMenus) {
this.id = pub.getId();
Expand All @@ -45,6 +36,7 @@ public SearchFreePubRes(FreePub pub, List<String> filteredMenus) {
this.latitude = pub.getLatitude();
this.longitude = pub.getLongitude();
if(pub.getNode() != null) this.nodeId = pub.getNode().getId();
this.address = pub.getAddress();
this.filteredMenus = filteredMenus;
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package devkor.com.teamcback.domain.koyeon.service;

import devkor.com.teamcback.domain.schoolcalendar.entity.SchoolCalendar;
import devkor.com.teamcback.domain.schoolcalendar.repository.SchoolCalendarRepository;
import devkor.com.teamcback.domain.koyeon.dto.response.*;
import devkor.com.teamcback.domain.koyeon.entity.*;
import devkor.com.teamcback.domain.koyeon.repository.*;
import devkor.com.teamcback.domain.schoolcalendar.entity.SchoolCalendar;
import devkor.com.teamcback.domain.schoolcalendar.repository.SchoolCalendarRepository;
import devkor.com.teamcback.global.exception.exception.GlobalException;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
Expand Down Expand Up @@ -72,10 +72,12 @@ public SearchFreePubListRes searchFreePubList(Long tagId) {
return new SearchFreePubListRes(pubResList);
}

return new SearchFreePubListRes(freePubRepository.findAll()
.stream()
.map(SearchFreePubRes::new)
.toList());
List<FreePub> pubList = freePubRepository.findAll();
List<SearchFreePubRes> pubResList = new ArrayList<>();
for (FreePub pub : pubList) {
pubResList.add(new SearchFreePubRes(pub, menuRepository.findByFreePub(pub).stream().map(Menu::getName).toList()));
}
return new SearchFreePubListRes(pubResList);
}

/**
Expand Down
Loading