Skip to content

feat(food): 음식 상세 응답에 이미지 갤러리 images[] 추가 - #264

Merged
rocher71 merged 2 commits into
developfrom
feat/kb565-food-detail-images
Sep 20, 2026
Merged

rocher71 merged 2 commits into
developfrom
feat/kb565-food-detail-images

Conversation

@rocher71

Copy link
Copy Markdown
Member

Jira: KB-565

Issue Number

(Jira 로만 추적 — 닫는 GitHub 이슈 없음)

무엇을 / 왜

앱 음식 상세에서 이미지를 여러 장 보여주기 위해(FE P-383) 공개 GET /api/foods/{foodId} 응답에 images[] 를 더한다. 필드 추가만이라 하위 호환이고 스키마 변경은 없다 — food_image 테이블과 백필은 KB-413(#230)에서 이미 들어갔다. Refs KB-565

변경 사항

  • FoodDetailResponse.images: List<FoodImageResponse> 추가. 항목은 해석된 url 과 isPrimary 둘뿐이다.
  • 정렬: 대표가 항상 첫 번째, 그다음 sort_order → id 순.
  • FoodService.getDetail 이 FoodImageJpaRepository 로 갤러리를 읽고 ImageUrls.resolve 로 URL 을 만든다. food_image 는 BaseEntity 의 @SQLRestriction 을 받으므로 소프트 삭제된 이미지는 자동 제외된다.

계약 메모

  • imageRef 는 그대로다. 대표 이미지의 정본은 여전히 imageRef 이고 앱의 기존 사용처는 영향이 없다.
  • 갤러리 행이 없으면 빈 배열이다. 없는 값을 imageRef 로 지어내지 않는다 — 어드민이 imageRef 를 직접 편집하면 갤러리와 어긋날 수 있는데, 그 동기화는 KB-414 범위라 여기서 임시로 메우면 그 불일치를 가린다.
  • 이미지 id 는 넣지 않았다. 공개 API 소비자는 목록 키로 url 이면 충분하고, id 가 필요한 쪽은 어드민 갤러리(KB-414)다. 필요하면 알려 주면 추가한다.

테스트

시나리오 기대
대표 1장 + 추가 2장 3건, 대표가 첫 번째, URL 해석
갤러리 행 없음 images 빈 배열, imageRef 유지
소프트 삭제된 이미지 혼재 살아 있는 이미지만

전체 빌드 그린(1897건 실행·실패 0).

🤖 Generated with Claude Code

https://claude.ai/code/session_01GukKBwfa8dRLMzhK4LoqvJ

@rocher71

Copy link
Copy Markdown
Member Author

@codex review

@github-actions github-actions Bot added feat 새로운 기능 develop develop 브랜치 대상 labels Sep 15, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-20T15:47:11.051736Z 15fbc25 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: 1085e8454c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@rocher71

Copy link
Copy Markdown
Member Author

isPrimary 제거 반영 — 항목이 {url} 하나가 됐습니다.

대표는 imageRef 로 이미 내려가고 정렬 규약이 "대표가 항상 첫 번째"라 같은 사실을 세 번 말하던 중복이었습니다. is- 접두 boolean 의 직렬화 함정도 계약에서 사라집니다.

내부 결과 타입도 해석된 URL 목록으로 줄였고, 정렬(대표 → sort_order → id)·빈 배열·소프트 삭제 제외는 그대로입니다. Swagger 는 "대표(imageRef 와 같은 URL)가 항상 첫 번째, 이후 정렬 순서"로 고쳤습니다. 테스트는 images[0].isPrimary 단언을 images[0].url == imageRef 로 교체했습니다(3건 실행·실패 0, 전체 빌드 그린).

@rocher71

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: 48097da672

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

rocher71 and others added 2 commits September 21, 2026 00:41
공개 GET /api/foods/{id} 에 images 배열을 더한다. 각 항목은 해석된 url 과
isPrimary 뿐이고, 대표가 항상 첫 번째로 온다(그다음은 sort_order·id 순).
food_image 는 BaseEntity 의 소프트 삭제 제약을 받으므로 살아 있는 행만 내려간다.

필드 추가만이라 하위 호환이고 기존 imageRef 는 그대로 둔다 — 대표 이미지의
정본은 여전히 imageRef 이며, 갤러리 행이 아직 없는 음식은 빈 배열이다.
어드민이 imageRef 를 직접 편집하면 갤러리와 어긋날 수 있는데, 그 동기화는
KB-414 범위라 여기서는 없는 값을 지어내지 않는다.

테스트: 대표+추가 2장의 순서·URL 해석, 갤러리 행이 없을 때 빈 배열,
소프트 삭제된 이미지 제외.

Refs KB-565

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GukKBwfa8dRLMzhK4LoqvJ
대표 이미지는 imageRef 로 이미 내려가고 정렬 규약이 "대표가 항상 첫 번째"라
isPrimary 는 같은 사실을 세 번째로 말하는 중복이다(예진 결정). 겸사겸사
is- 접두 boolean 의 직렬화 함정도 계약에서 사라진다.

응답 항목은 {url} 하나가 되고, 내부 결과 타입도 해석된 URL 목록으로 줄인다.
정렬(대표 우선 → sort_order → id)·빈 배열·소프트 삭제 제외는 그대로다.
Swagger 는 "대표(imageRef 와 같은 URL)가 항상 첫 번째"로 고쳤다.

테스트: images[0].isPrimary 단언을 images[0].url == imageRef 로 바꿨다.

Refs KB-565

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GukKBwfa8dRLMzhK4LoqvJ
@rocher71
rocher71 force-pushed the feat/kb565-food-detail-images branch from 48097da to 15fbc25 Compare September 20, 2026 15:44
@rocher71

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: 15fbc252a2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@rocher71
rocher71 added this pull request to the merge queue Sep 20, 2026
Merged via the queue into develop with commit 6c80b44 Sep 20, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

develop develop 브랜치 대상 feat 새로운 기능

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant