Skip to content

Commit

Permalink
Fix: handling of absent photoList, periodList
Browse files Browse the repository at this point in the history
  • Loading branch information
chanwoonglee committed Aug 1, 2024
1 parent ef0d80a commit 96e7bce
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/search/search.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export class SearchService {
kakaoPlace.commentCnt = feedback.comntcnt;
kakaoPlace.mainPhotoUrl = basicInfo.mainphotourl;
kakaoPlace.score = feedback.scoresum / feedback.scorecnt;
kakaoPlace.openTimeList = basicInfo.openHour.periodList.flatMap(
kakaoPlace.openTimeList = (basicInfo.openHour?.periodList || []).flatMap(
(period) => period.timeList,
);
kakaoPlace.offDayList = basicInfo.openHour.offdayList;
Expand All @@ -193,8 +193,8 @@ export class SearchService {
kakaoPlace.y = coord.y;

// TODO: 음식사진 가져오는것도 약간 우선순위를 두면 좋을듯
kakaoPlace.photoList = kakaoPlaceRaw.photo.photoList
.flatMap((photo) => photo.list)
kakaoPlace.photoList = (kakaoPlaceRaw.photo?.photoList || [])
.flatMap((photo) => photo.list || [])
.map((photo) => photo.orgurl)
.slice(0, 10);
await this.kakaoPlaceRepository.upsert(kakaoPlace);
Expand Down

0 comments on commit 96e7bce

Please sign in to comment.