Skip to content

[refactor] 홍보 이미지업로드를 POST 한 번으로 줄인다 - #2087

Open
seongwon030 wants to merge 1 commit into
develop-fefrom
refactor/#2086-promotion-presign-without-article-MOA-1137
Open

seongwon030 wants to merge 1 commit into
develop-fefrom
refactor/#2086-promotion-presign-without-article-MOA-1137

Conversation

@seongwon030

Copy link
Copy Markdown
Member

#️⃣연관된 이슈

close #2086

⚠️ 백엔드 #2084가 먼저 배포돼야 합니다. 이 PR이 먼저 나가면 POST /api/promotion/upload-url이 404라 홍보 이미지 업로드가 전부 실패합니다. (#2084는 선행 PR #2081 위에 쌓여 있습니다.)

📝작업 내용

백엔드 #2084(MOA-1135)에서 홍보 이미지 키가 promotion/articles/{articleId}/promotion/{clubId}/ 로 바뀌면서, presign 발급에 게시글이 더 이상 필요 없어졌습니다. 관리자용 홍보 게시글 작성·수정 화면이 이에 맞춰 바뀝니다.

요청 순서가 바뀝니다

지금 작성은 게시글이 있어야 업로드 URL을 받을 수 있어서 두 번 돕니다.

빈 images로 POST → articleId 수령 → 업로드 → PUT으로 이미지 반영

발급이 게시글에 의존하지 않으므로 업로드를 먼저 하고 저장합니다.

업로드 → 작성이면 POST 한 번 / 수정이면 PUT
작성 시 저장 요청 POST + PUT POST 한 번
중간 실패 시 빈 글이 남음 남는 글 없음

바뀌는 것

  • getPromotionImageUploadUrlsarticleId 파라미터 제거, POST /api/promotion/upload-url. 대상 동아리는 서버가 토큰에서 정하므로 프론트는 clubId를 보내지 않습니다.
  • useUploadPromotionImagesFile[]만 받습니다 (PromotionImageUploadParams 제거).
  • usePromotionForm — 업로드 → 저장 순서. POST가 마지막 한 번만 나가므로 createdArticleIdRef가 사라집니다. "작성인데 올라간 이미지가 0장이면 PUT을 건너뛴다"는 조기 반환도 함께 없어집니다.

가드 하나를 작성 쪽으로도 넓혔습니다

"한 장도 안 남았는데 업로드 실패가 있으면 저장하지 않는다"는 지금 수정 전용인데, 조기 반환이 사라지면서 작성도 이 경로를 지납니다. 여기서 그대로 POST하면 이미지를 넣으려던 글이 이미지 없이 만들어집니다. 이제 아무것도 만들지 않고 에러만 내므로 재시도가 깨끗합니다.

일부만 실패한 경우(partial)는 작성에서도 여전히 발생할 수 있어 상태를 남겼습니다. 없애면 몇 장이 빠졌는지 사용자가 알 수 없습니다.

중점적으로 리뷰받고 싶은 부분(선택)

  • 위 가드 통일이 맞는 판단인지 — 작성에서 업로드가 전부 실패했을 때 "글이라도 만든다"와 "아무것도 안 만든다" 중 후자를 골랐습니다.
  • partial을 작성에서도 유지한 것PromotionEditTab은 작성 partial일 때 수정 화면으로 replace 이동시키는데, 그 시점엔 실패한 로컬 파일이 이미 사라져서 토스트 문구("실패한 이미지는 그대로 있으니")와 어긋납니다. 기존부터 있던 어긋남이라 이 PR에서는 건드리지 않았습니다.

🫡 참고사항

  • 손대지 않아도 되는 것들을 확인했습니다.
    • 16장 이상 거부PromotionImageField가 이미 PROMOTION_IMAGE_MAX_COUNT=15로 총량을 막고, presign 배열에는 아직 안 올린 local 파일만 들어가므로 15개를 넘길 수 없습니다.
    • 구 키(promotion/articles/...) 게시글 제목만 수정 — 기존 URL을 그대로 images에 실어 보내고 백엔드가 재검증하지 않으므로 통과합니다.
    • PromotionEditTab.test.tsx에는 presign 기대값이 없어 변경할 것이 없었습니다.
  • 검증tsc --noEmit 통과, jest 전체 65 suites / 555 tests 통과, eslint 에러 0. 실제 브라우저 확인(네트워크 탭에서 PUT이 안 나가는지)은 백엔드 배포 후에 해야 합니다.
  • src/hooks/Queries/CLAUDE.md의 홍보 presign 설명도 새 순서로 갱신했습니다.

이미지 키가 동아리 기준(promotion/{clubId}/)으로 바뀌어 게시글 없이 발급된다.
업로드를 먼저 하고 저장하므로 작성은 POST 한 번으로 끝나고, 중간에 실패해도
남는 글이 없어 createdArticleIdRef가 필요 없어진다.

업로드가 전부 실패했을 때 저장하지 않는 가드는 작성·수정 공통으로 올렸다.
작성에서 그대로 POST하면 이미지를 넣으려던 글이 빈 목록으로 만들어진다.
@vercel

vercel Bot commented Sep 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
moadong Ready Ready Preview Sep 20, 2026 2:53pm UTC

@coderabbitai

coderabbitai Bot commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 18 seconds.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository: Moadong/moadong/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 8d831dac-82f8-4a06-a562-e668c912709f

📥 Commits

Reviewing files that changed from the base of the PR and between fef0387 and 9551f89.

📒 Files selected for processing (6)
  • frontend/src/apis/promotion.test.ts
  • frontend/src/apis/promotion.ts
  • frontend/src/hooks/Queries/CLAUDE.md
  • frontend/src/hooks/Queries/usePromotion.ts
  • frontend/src/pages/AdminPage/tabs/PromotionTab/hooks/usePromotionForm.test.ts
  • frontend/src/pages/AdminPage/tabs/PromotionTab/hooks/usePromotionForm.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added 💻 FE Frontend 🚁AI claude, codex 활용 시 labels Sep 20, 2026
@seongwon030 seongwon030 added the 🔨 Refactor 코드 리팩토링 label Sep 20, 2026
@github-actions

Copy link
Copy Markdown

✅ UI 변경사항 없음

구분 링크
📖 Storybook https://67904e61c16daa99a63b44a7-tbtaqtzhvl.chromatic.com/

전체 184개 스토리 · 66개 컴포넌트

@seongwon030 seongwon030 removed the 🚁AI claude, codex 활용 시 label Sep 20, 2026
@seongwon030 seongwon030 changed the title [refactor] MOA-1137 홍보 이미지 presign 변경에 맞춰 작성 흐름을 POST 한 번으로 줄인다 [refactor] 홍보 이미지업로드를 POST 한 번으로 줄인다 Sep 20, 2026
@github-actions github-actions Bot added the 🚁AI claude, codex 활용 시 label Sep 20, 2026
@seongwon030 seongwon030 removed the 🚁AI claude, codex 활용 시 label Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💻 FE Frontend 🔨 Refactor 코드 리팩토링

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant