[refactor] 홍보 이미지업로드를 POST 한 번으로 줄인다 - #2087
Open
seongwon030 wants to merge 1 commit into
Open
seongwon030 wants to merge 1 commit into
seongwon030 wants to merge 1 commit into
Conversation
이미지 키가 동아리 기준(promotion/{clubId}/)으로 바뀌어 게시글 없이 발급된다.
업로드를 먼저 하고 저장하므로 작성은 POST 한 번으로 끝나고, 중간에 실패해도
남는 글이 없어 createdArticleIdRef가 필요 없어진다.
업로드가 전부 실패했을 때 저장하지 않는 가드는 작성·수정 공통으로 올렸다.
작성에서 그대로 POST하면 이미지를 넣으려던 글이 빈 목록으로 만들어진다.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
Warning Review limit reachedNext included review available in 18 seconds. View limit detailsLimit 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. Review configuration: ⚙️ Run configurationConfiguration used: Repository: Moadong/moadong/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (6)
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. Comment |
✅ UI 변경사항 없음
전체 184개 스토리 · 66개 컴포넌트 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#️⃣연관된 이슈
close #2086
📝작업 내용
백엔드 #2084(MOA-1135)에서 홍보 이미지 키가
promotion/articles/{articleId}/→promotion/{clubId}/로 바뀌면서, presign 발급에 게시글이 더 이상 필요 없어졌습니다. 관리자용 홍보 게시글 작성·수정 화면이 이에 맞춰 바뀝니다.요청 순서가 바뀝니다
지금 작성은 게시글이 있어야 업로드 URL을 받을 수 있어서 두 번 돕니다.
발급이 게시글에 의존하지 않으므로 업로드를 먼저 하고 저장합니다.
바뀌는 것
getPromotionImageUploadUrls—articleId파라미터 제거,POST /api/promotion/upload-url. 대상 동아리는 서버가 토큰에서 정하므로 프론트는clubId를 보내지 않습니다.useUploadPromotionImages—File[]만 받습니다 (PromotionImageUploadParams제거).usePromotionForm— 업로드 → 저장 순서. POST가 마지막 한 번만 나가므로createdArticleIdRef가 사라집니다. "작성인데 올라간 이미지가 0장이면 PUT을 건너뛴다"는 조기 반환도 함께 없어집니다.가드 하나를 작성 쪽으로도 넓혔습니다
"한 장도 안 남았는데 업로드 실패가 있으면 저장하지 않는다"는 지금 수정 전용인데, 조기 반환이 사라지면서 작성도 이 경로를 지납니다. 여기서 그대로 POST하면 이미지를 넣으려던 글이 이미지 없이 만들어집니다. 이제 아무것도 만들지 않고 에러만 내므로 재시도가 깨끗합니다.
일부만 실패한 경우(
partial)는 작성에서도 여전히 발생할 수 있어 상태를 남겼습니다. 없애면 몇 장이 빠졌는지 사용자가 알 수 없습니다.중점적으로 리뷰받고 싶은 부분(선택)
partial을 작성에서도 유지한 것 —PromotionEditTab은 작성 partial일 때 수정 화면으로replace이동시키는데, 그 시점엔 실패한 로컬 파일이 이미 사라져서 토스트 문구("실패한 이미지는 그대로 있으니")와 어긋납니다. 기존부터 있던 어긋남이라 이 PR에서는 건드리지 않았습니다.🫡 참고사항
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 설명도 새 순서로 갱신했습니다.