Skip to content

Commit

Permalink
feat: 즐겨찾는 장소 리스트 보기
Browse files Browse the repository at this point in the history
- 출력 모양 변경
  • Loading branch information
anstjgus922 committed Aug 2, 2024
1 parent b1497a3 commit 6f55b28
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,19 @@ public FavPlace getFavoritePlaceDetails(FavPlace.AddrType addrType, String email

@Transactional(readOnly = true)
public List<FavPlaceResponse> getAllFavoritePlaces(String email) {
// 회원 조회
Member member = memberRepository.findByEmail(email)
.orElseThrow(() -> new IllegalArgumentException("해당 이메일의 회원이 존재하지 않습니다."));

List<FavPlace> favPlaces = favPlaceRepository.findAllByMemberId(member.getId());

Map<FavPlace.AddrType, FavPlaceResponse> responseMap = new HashMap<>();

responseMap.put(FavPlace.AddrType.HOME, new FavPlaceResponse(null, null, FavPlace.AddrType.HOME.name()));
responseMap.put(FavPlace.AddrType.WORK, new FavPlaceResponse(null, null, FavPlace.AddrType.WORK.name()));

for (FavPlace favPlace : favPlaces) {
FavPlace.AddrType addrType = favPlace.getAddrType();
if (!responseMap.containsKey(addrType)) {
if (responseMap.containsKey(addrType)) {
responseMap.put(addrType, new FavPlaceResponse(
favPlace.getFavPlaceId(),
favPlace.getAddr(),
Expand Down

0 comments on commit 6f55b28

Please sign in to comment.