todo 오류 있던거 수정 이젠 디비꺼도 지워짐
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user