Repository navigation
[Refactor/#521] 전체 이미지 presigned 업로드 계약 동기화 #523
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -26,22 +26,17 @@ const AdminCarousel = ({ saveCarouselData, saveCarouselNum }) => { | |||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| useEffect(() => { | ||||||||||||||||||||||||
| setCarouselList(data?.promotionList); | ||||||||||||||||||||||||
| saveCarouselData(data?.promotionList ?? []); | ||||||||||||||||||||||||
| saveCarouselNum( | ||||||||||||||||||||||||
| data?.promotionList.map((item) => { | ||||||||||||||||||||||||
| return item.promotionId; | ||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||
| }) ?? [] | ||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||
|
Comment on lines
30
to
34
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
옵셔널 체이닝이 🐛 제안 수정 saveCarouselNum(
- data?.promotionList.map((item) => {
+ data?.promotionList?.map((item) => {
return item.promotionId;
}) ?? []
);📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| console.log(data?.promotionList, [ | ||||||||||||||||||||||||
| data?.promotionList.map((item) => { | ||||||||||||||||||||||||
| return item.promotionId; | ||||||||||||||||||||||||
| }), | ||||||||||||||||||||||||
| ]); | ||||||||||||||||||||||||
| }, [data]); | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| const addCarousel = () => { | ||||||||||||||||||||||||
| const newCarousel = { | ||||||||||||||||||||||||
| promotionId: carouselList.length, | ||||||||||||||||||||||||
| promotionId: -(Date.now() + carouselList.length), | ||||||||||||||||||||||||
| promotionPhoto: null, | ||||||||||||||||||||||||
| performanceId: null, | ||||||||||||||||||||||||
| isExternal: false, | ||||||||||||||||||||||||
|
|
@@ -51,6 +46,7 @@ const AdminCarousel = ({ saveCarouselData, saveCarouselNum }) => { | |||||||||||||||||||||||
| const updatedCarouselList = [...carouselList, newCarousel]; | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| setCarouselList(updatedCarouselList); | ||||||||||||||||||||||||
| saveCarouselData(updatedCarouselList); | ||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| const deleteCarousel = (idx: number) => { | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,17 +6,23 @@ | |
| } | ||
|
|
||
| export interface PresignedResponse { | ||
| poster: ImageInterface; | ||
| cast: ImageInterface; | ||
| staff: ImageInterface; | ||
| performance: ImageInterface; | ||
| poster: Record<string, ImagePresignedUpload>; | ||
| cast: Record<string, ImagePresignedUpload>; | ||
| staff: Record<string, ImagePresignedUpload>; | ||
| performance: Record<string, ImagePresignedUpload>; | ||
| } | ||
|
|
||
| export interface ImagePresignedUpload { | ||
| uploadUrl: string; | ||
| imageKey: string; | ||
| } | ||
|
|
||
| export interface PresignedAllResponse { | ||
| status: number; | ||
| message: string; | ||
| data: { | ||
| performanceMakerPresignedUrls: PresignedResponse; | ||
| performanceMakerPresignedUrls: Record<string, ImageInterface>; | ||
| performanceMakerPresignedUploads: PresignedResponse; | ||
|
Comment on lines
+9
to
+25
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# 스키마 정의와 수동 타입 선언 비교
rg -n -A4 'ImagePresignedUpload:|CarouselPresignedUploadResponse:|BannerPresignedUploadResponse:' src/typings/api/schema/index.ts
rg -n -B2 -A6 'interface ImagePresignedUpload' src
# uploadUrl 사용처
rg -n '\.uploadUrl' srcRepository: TEAM-BEAT/BEAT-Client Length of output: 1813 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '--- src/apis/domains/files/api.ts lines 1-120 ---\n'
sed -n '1,120p' src/apis/domains/files/api.ts
printf '\n--- src/apis/domains/files/api.ts usages around presigned all response ---\n'
rg -n -B5 -A25 'PresignedAllResponse|getPresignedA|presigned|upload.*ImagePresignedUpload|data:.*ImagePresignedUpload' src/apis/domains/files/api.ts
printf '\n--- Register.tsx upload checks and calls ---\n'
sed -n '160,270p' src/pages/register/Register.tsx
printf '\n--- ModifyManage.tsx upload checks and calls ---\n'
sed -n '320,365p' src/pages/modifyManage/ModifyManage.tsx
printf '\n--- Promotion.tsx upload checks and calls ---\n'
sed -n '60,90p' src/admin/pages/promotion/Promotion.tsxRepository: TEAM-BEAT/BEAT-Client Length of output: 250 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '--- src/apis/domains/files/api.ts lines 1-120 ---\n'
sed -n '1,120p' src/apis/domains/files/api.ts
printf '\n--- src/apis/domains/files/api.ts usages around presigned all response ---\n'
rg -n -B5 -A25 'PresignedAllResponse|getPresignedA|presigned|upload.*ImagePresignedUpload|data:.*ImagePresignedUpload' src/apis/domains/files/api.ts
printf '\n--- Register.tsxo upload checks and calls ---\n'
sed -n '160,270p' src/pages/register/Register.tsx
printf '\n--- ModifyManage.tsx upload checks and calls ---\n'
sed -n '320,365p' src/pages/modifyManage/ModifyManage.tsx
printf '\n--- Promotion.tsx upload checks and calls ---\n'
sed -n '60,90p' src/admin/pages/promotion/Promotion.tsxRepository: TEAM-BEAT/BEAT-Client Length of output: 250 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo '--- src/apis/domains/files/api.ts lines 1-120 ---'
sed -n '1,120p' src/apis/domains/files/api.ts
echo
echo '--- src/apis/domains/files/api.ts usages around presigned all response ---'
rg -n -B5 -A25 'PresignedAllResponse|getPresignedA|presigned|upload.*ImagePresignedUpload|data:.*ImagePresignedUpload' src/apis/domains/files/api.ts
echo
echo '--- Register.tsx upload checks and calls ---'
sed -n '160,270p' src/pages/register/Register.tsx
echo
echo '--- ModifyManage.tsx upload checks and calls ---'
sed -n '320,365p' src/pages/modifyManage/ModifyManage.tsx
echo
echo '--- Promotion.tsx upload checks and calls ---'
sed -n '60,90p' src/admin/pages/promotion/Promotion.tsxRepository: TEAM-BEAT/BEAT-Client Length of output: 12733
🤖 Prompt for AI Agents |
||
| }; | ||
| } | ||
|
|
||
|
|
@@ -56,7 +62,7 @@ | |
| }, | ||
| }); | ||
|
|
||
| return response.data.data.performanceMakerPresignedUrls; | ||
| return response.data.data.performanceMakerPresignedUploads; | ||
| } catch (error) { | ||
| console.error("error", error); | ||
| return null; | ||
|
|
@@ -88,16 +94,19 @@ | |
| export interface CarouselPresignedResponse { | ||
| data: { | ||
| carouselPresignedUrls: ImageInterface; | ||
| carouselPresignedUploads: Record<string, CarouselPresignedUpload>; | ||
| }; | ||
| } | ||
|
|
||
| export type CarouselPresignedUpload = ImagePresignedUpload; | ||
|
|
||
| export interface GetCarouselPresignedUrlParams { | ||
| carouselImages: string[]; | ||
| } | ||
|
|
||
| export const getCarouselPresignedUrl = async ( | ||
| params: GetCarouselPresignedUrlParams | ||
| ): Promise<CarouselPresignedResponse | null> => { | ||
| ): Promise<CarouselPresignedResponse> => { | ||
| try { | ||
| const paramsWithEmptyArrays = { | ||
| ...params, | ||
|
|
@@ -126,8 +135,7 @@ | |
| ); | ||
|
|
||
| return response.data; | ||
| } catch (error) { | ||
|
Check warning on line 138 in src/apis/domains/files/api.ts
|
||
| console.error("error", error); | ||
| return null; | ||
| throw error; | ||
| } | ||
| }; | ||
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
캐러셀을 전부 삭제한 뒤 저장하면 아무 반응이 없습니다.
formData.carousels.length === 0이면updateCarousel도 호출되지 않고 else 분기의forEach도 순회 대상이 없어 알림이 뜨지 않습니다. 사용자는 저장이 됐는지 알 수 없습니다. 빈 목록에 대한 처리(전체 삭제 저장을 허용하거나, 최소 1개 필요 안내)를 추가해 주세요.🤖 Prompt for AI Agents