todo 오류 있던거 수정 이젠 디비꺼도 지워짐
This commit is contained in:
parent
86135dcf10
commit
1e3136cb0b
|
|
@ -1,54 +1,14 @@
|
|||
[
|
||||
{
|
||||
"id": "e5bb334c-d58a-4068-ad77-2607a41f4675",
|
||||
"title": "ㅁㄴㅇㄹ",
|
||||
"description": "ㅁㄴㅇㄹ",
|
||||
"priority": "normal",
|
||||
"status": "completed",
|
||||
"assignedTo": "",
|
||||
"dueDate": "2025-10-20T18:17",
|
||||
"createdAt": "2025-10-20T06:15:49.610Z",
|
||||
"updatedAt": "2025-10-20T07:36:06.370Z",
|
||||
"isUrgent": false,
|
||||
"order": 0,
|
||||
"completedAt": "2025-10-20T07:36:06.370Z"
|
||||
},
|
||||
{
|
||||
"id": "334be17c-7776-47e8-89ec-4b57c4a34bcd",
|
||||
"title": "연동되어주겠니?",
|
||||
"description": "",
|
||||
"priority": "normal",
|
||||
"status": "pending",
|
||||
"assignedTo": "",
|
||||
"dueDate": "",
|
||||
"createdAt": "2025-10-20T06:20:06.343Z",
|
||||
"updatedAt": "2025-10-20T06:20:06.343Z",
|
||||
"isUrgent": false,
|
||||
"order": 1
|
||||
},
|
||||
{
|
||||
"id": "f85b81de-fcbd-4858-8973-247d9d6e70ed",
|
||||
"title": "연동되어주겠니?11",
|
||||
"description": "ㄴㅇㄹ",
|
||||
"priority": "normal",
|
||||
"status": "pending",
|
||||
"assignedTo": "",
|
||||
"dueDate": "2025-10-20T17:22",
|
||||
"createdAt": "2025-10-20T06:20:53.818Z",
|
||||
"updatedAt": "2025-10-20T06:20:53.818Z",
|
||||
"isUrgent": false,
|
||||
"order": 2
|
||||
},
|
||||
{
|
||||
"id": "58d2b26f-5197-4df1-b5d4-724a72ee1d05",
|
||||
"title": "연동되어주려무니",
|
||||
"description": "ㅁㄴㅇㄹ",
|
||||
"priority": "normal",
|
||||
"status": "pending",
|
||||
"status": "in_progress",
|
||||
"assignedTo": "",
|
||||
"dueDate": "2025-10-21T15:21",
|
||||
"createdAt": "2025-10-20T06:21:19.817Z",
|
||||
"updatedAt": "2025-10-20T06:21:19.817Z",
|
||||
"updatedAt": "2025-10-20T09:00:26.948Z",
|
||||
"isUrgent": false,
|
||||
"order": 3
|
||||
}
|
||||
|
|
|
|||
|
|
@ -155,10 +155,15 @@ export class TodoService {
|
|||
updates: Partial<TodoItem>
|
||||
): Promise<TodoItem> {
|
||||
try {
|
||||
if (DATA_SOURCE === "database") {
|
||||
// 먼저 데이터베이스에서 찾아보고, 없으면 파일에서 찾기
|
||||
try {
|
||||
return await this.updateTodoDB(id, updates);
|
||||
} else {
|
||||
return this.updateTodoFile(id, updates);
|
||||
} catch (dbError: any) {
|
||||
// 데이터베이스에서 찾지 못했으면 파일에서 찾기
|
||||
if (dbError.message && dbError.message.includes("찾을 수 없습니다")) {
|
||||
return this.updateTodoFile(id, updates);
|
||||
}
|
||||
throw dbError;
|
||||
}
|
||||
} catch (error) {
|
||||
logger.error("❌ To-Do 수정 오류:", error);
|
||||
|
|
@ -171,10 +176,16 @@ export class TodoService {
|
|||
*/
|
||||
public async deleteTodo(id: string): Promise<void> {
|
||||
try {
|
||||
if (DATA_SOURCE === "database") {
|
||||
// 먼저 데이터베이스에서 찾아보고, 없으면 파일에서 찾기
|
||||
try {
|
||||
await this.deleteTodoDB(id);
|
||||
} else {
|
||||
this.deleteTodoFile(id);
|
||||
} catch (dbError: any) {
|
||||
// 데이터베이스에서 찾지 못했으면 파일에서 찾기
|
||||
if (dbError.message && dbError.message.includes("찾을 수 없습니다")) {
|
||||
this.deleteTodoFile(id);
|
||||
} else {
|
||||
throw dbError;
|
||||
}
|
||||
}
|
||||
logger.info(`✅ To-Do 삭제: ${id}`);
|
||||
} catch (error) {
|
||||
|
|
|
|||
|
|
@ -249,11 +249,18 @@ export default function TodoWidget({ element }: TodoWidgetProps) {
|
|||
},
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
fetchTodos();
|
||||
// 응답이 성공이거나, 500 에러여도 실제로는 삭제되었을 수 있으므로 목록 새로고침
|
||||
if (response.ok || response.status === 500) {
|
||||
// 약간의 딜레이 후 새로고침 (백엔드 처리 완료 대기)
|
||||
setTimeout(() => {
|
||||
fetchTodos();
|
||||
}, 300);
|
||||
}
|
||||
} catch (error) {
|
||||
// console.error("To-Do 삭제 오류:", error);
|
||||
// 네트워크 에러여도 삭제되었을 수 있으므로 새로고침
|
||||
setTimeout(() => {
|
||||
fetchTodos();
|
||||
}, 300);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue