From f441f5b7bdd3f8c4f0fab271bae181c659a7b220 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=EC=A1=B0=EB=8C=80=ED=9D=AC?= <joedaehui@ajou.ac.kr>
Date: Thu, 14 Nov 2024 23:07:27 +0900
Subject: [PATCH] =?UTF-8?q?feat:=20=EA=B3=A0=EC=A0=95/=EC=9C=A0=EB=8F=99?=
 =?UTF-8?q?=20=EC=8A=A4=EC=BC=80=EC=A4=84=20=EC=88=98=EC=A0=95=20(#5)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 services/scheduleService.js | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/services/scheduleService.js b/services/scheduleService.js
index 4d971fc..5bb7dad 100644
--- a/services/scheduleService.js
+++ b/services/scheduleService.js
@@ -36,4 +36,27 @@ class schedulService {
         }
     }
 
+    /**
+     * 사용자 스케줄 수정
+     */
+    async updateSchedule(id, userId, updateData) {
+        try {
+            const schedule = await Schedule.findOne({
+                where: { id, user_id: userId }
+            });
+
+            if (!schedule) {
+                throw new Error('schedule not found');
+            }
+
+            // 스케줄 타입 변경하지 못하도록 update값 삭제 -> 기존값 유지
+            delete updateData.is_fixed;
+            
+            await schedule.update(updateData);
+            return schedule;
+        } catch (error) {
+            throw new Error(`Failed to update schedule: ${error.message}`);
+        }
+    }
+
 }
\ No newline at end of file
-- 
GitLab