From 14ffc888676779e4d10c6d5870bd37933dae76f4 Mon Sep 17 00:00:00 2001 From: GGGGGGGGGGGGGGG_J <115770858+NaturalSoda4552@users.noreply.github.com> Date: Tue, 27 Jan 2026 17:25:47 +0900 Subject: [PATCH 1/8] =?UTF-8?q?feat:=20=EA=B3=84=ED=9A=8D=20=EA=B4=80?= =?UTF-8?q?=EB=A6=AC=20=ED=8E=98=EC=9D=B4=EC=A7=80=20=ED=94=8C=EB=9E=9C=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20=EB=A9=94=EC=84=9C=EB=93=9C=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/plans/planManageService.service.ts | 27 ++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/services/plans/planManageService.service.ts b/services/plans/planManageService.service.ts index f22abc8..551f02d 100644 --- a/services/plans/planManageService.service.ts +++ b/services/plans/planManageService.service.ts @@ -142,7 +142,32 @@ export const deletePlanItem = async (uid: string, itemId: string) => { await deleteDoc(itemRef); }; -// 8. 하위 항목 수정 (제목, 설명, 마감일) +// 8. 플랜 수정 (제목, 설명) +export const updatePlan = async ( + uid: string, + planId: string, + updates: { text?: string; description?: string } +) => { + const planRef = doc(db, 'users', uid, 'plans', planId); + + const updatePayload: { + text?: string; + description?: string; + } = {}; + + if (updates.text !== undefined) { + updatePayload.text = updates.text; + } + if (updates.description !== undefined) { + updatePayload.description = updates.description; + } + + if (Object.keys(updatePayload).length > 0) { + await updateDoc(planRef, updatePayload); + } +}; + +// 9. 하위 항목 수정 (제목, 설명, 마감일) export const updatePlanItem = async ( uid: string, itemId: string, From 3e06dd84c719a47df445f8c325f411d032cd11be Mon Sep 17 00:00:00 2001 From: GGGGGGGGGGGGGGG_J <115770858+NaturalSoda4552@users.noreply.github.com> Date: Tue, 27 Jan 2026 18:34:14 +0900 Subject: [PATCH 2/8] =?UTF-8?q?feat:=20=EA=B3=84=ED=9A=8D=20=EA=B4=80?= =?UTF-8?q?=EB=A6=AC=20=ED=8E=98=EC=9D=B4=EC=A7=80=20=ED=94=8C=EB=9E=9C=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20=EA=B8=B0=EB=8A=A5=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/(with-sidebar)/plans/page.tsx | 24 ++++++ components/plans/PlanSection.tsx | 94 ++++++++++++++++++--- services/plans/planManageService.service.ts | 8 +- 3 files changed, 112 insertions(+), 14 deletions(-) diff --git a/app/(with-sidebar)/plans/page.tsx b/app/(with-sidebar)/plans/page.tsx index 701cce3..448fce6 100644 --- a/app/(with-sidebar)/plans/page.tsx +++ b/app/(with-sidebar)/plans/page.tsx @@ -9,6 +9,7 @@ import { deletePlanItem, fetchPlans, Plan, + updatePlan, } from '@/services/plans/planManageService.service'; import PageHeader from '@/components/common/PageHeader'; @@ -94,6 +95,28 @@ const Page = () => { } }; + // 플랜 수정 핸들러 + const handleUpdatePlan = async ( + planId: string, + title: string, + description: string + ) => { + if (!user) { + alert('로그인이 필요합니다.'); + return; + } + + try { + await updatePlan(user.uid, planId, { title, description }); + + // 목록 새로고침 + const fetchedPlans = await fetchPlans(user.uid); + setPlans(fetchedPlans); + } catch (err) { + console.error(err); + } + }; + return (
{description}
-{description}
+플랜을 불러오는 중...
- ) : ( -플랜을 불러오는 중...
+ ) : ( +아직 생성된 플랜이 없습니다. 첫 플랜을 추가해보세요!
)} - - - {/* 하단 추가 버튼 or 인라인 폼 */} -플랜을 불러오는 중...
@@ -240,20 +254,6 @@ const Page = () => { onPageChange={setCurrentPage} /> )} - - {/* 하단 추가 버튼 or 인라인 폼 */} -