Skip to content

Commit 14ffc88

Browse files
committed
feat: 계획 관리 페이지 플랜 수정 메서드 구현
1 parent 5809b2e commit 14ffc88

1 file changed

Lines changed: 26 additions & 1 deletion

File tree

services/plans/planManageService.service.ts

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,32 @@ export const deletePlanItem = async (uid: string, itemId: string) => {
142142
await deleteDoc(itemRef);
143143
};
144144

145-
// 8. 하위 항목 수정 (제목, 설명, 마감일)
145+
// 8. 플랜 수정 (제목, 설명)
146+
export const updatePlan = async (
147+
uid: string,
148+
planId: string,
149+
updates: { text?: string; description?: string }
150+
) => {
151+
const planRef = doc(db, 'users', uid, 'plans', planId);
152+
153+
const updatePayload: {
154+
text?: string;
155+
description?: string;
156+
} = {};
157+
158+
if (updates.text !== undefined) {
159+
updatePayload.text = updates.text;
160+
}
161+
if (updates.description !== undefined) {
162+
updatePayload.description = updates.description;
163+
}
164+
165+
if (Object.keys(updatePayload).length > 0) {
166+
await updateDoc(planRef, updatePayload);
167+
}
168+
};
169+
170+
// 9. 하위 항목 수정 (제목, 설명, 마감일)
146171
export const updatePlanItem = async (
147172
uid: string,
148173
itemId: string,

0 commit comments

Comments
 (0)