Skip to content

Commit 7993761

Browse files
authored
Merge pull request #373 from DDD-Community/bug/369/todo
fix: 단일 투두 수정 시 루틴 연결 유지하도록 변경 (bug/369/todo)
2 parents 07609c4 + 3c1d0f5 commit 7993761

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

app/src/main/java/com/growit/app/todo/domain/ToDo.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,15 @@ public void updateBy(UpdateToDoCommand command) {
5050
this.routine = command.routine();
5151
}
5252

53+
public void updateContentOnly(UpdateToDoCommand command) {
54+
// 루틴 정보는 유지하고 내용만 변경
55+
this.date = command.date();
56+
this.goalId = command.goalId();
57+
this.content = command.content();
58+
this.isImportant = command.isImportant();
59+
// routine은 변경하지 않음
60+
}
61+
5362
public void removeRoutine() {
5463
this.routine = null;
5564
}

app/src/main/java/com/growit/app/todo/domain/service/RoutineServiceImpl.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,8 @@ public ToDoResult updateRoutineToDos(ToDo existingToDo, UpdateToDoCommand comman
187187
}
188188

189189
private ToDoResult updateSingleToDo(ToDo existingToDo, UpdateToDoCommand command) {
190-
// 단일 투두 수정: 해당 투두만 수정하고 루틴 연결을 제거하여 독립적으로 만듦
191-
existingToDo.updateBy(command);
192-
existingToDo.removeRoutine(); // 루틴 연결 제거하여 단일 투두로 변경
190+
// 단일 투두 수정: 해당 투두만 내용 변경하고 반복 연결은 유지
191+
existingToDo.updateContentOnly(command);
193192
toDoRepository.saveToDo(existingToDo);
194193
return new ToDoResult(existingToDo.getId());
195194
}

0 commit comments

Comments
 (0)