Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public record TodoResponse(
String priority,
TagResponse tag,
@Schema(requiredMode = Schema.RequiredMode.REQUIRED)
boolean hasSubtask,
boolean hasMemo,
@JsonProperty("isRepeated")
@Schema(requiredMode = Schema.RequiredMode.REQUIRED)
boolean isRepeated,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public record TodayTodoResponse(
@Schema(requiredMode = Schema.RequiredMode.REQUIRED)
boolean isRepeated,
@Schema(requiredMode = Schema.RequiredMode.REQUIRED)
boolean hasSubtask,
boolean hasMemo,
@Schema(requiredMode = Schema.RequiredMode.REQUIRED)
TodoTimerStatus timerStatus,
Integer sortOrder,
Expand All @@ -78,7 +78,7 @@ public static TodayTodoResponse from(LocalDate date, TodoResponse todo) {
todo.priority(),
todo.tag(),
todo.isRepeated(),
todo.hasSubtask(),
todo.hasMemo(),
todo.timerStatus(),
todo.sortOrder(),
todo.subtasks()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,19 @@ public TodoResponse toResponse(TodoContext context) {
todo.getDurationSeconds(),
todo.getPriority() != null ? todo.getPriority().name() : null,
mapTag(context.tag()),
!todo.getSubtasks().isEmpty(),
hasMemo(todo, instance),
todo.getRepeatType() != RepeatType.NONE,
resolveTimerStatus(instance),
instance != null ? instance.getSortOrder() : context.defaultSortOrder(),
mapSubtasks(todo.getSubtasks(), context.completedSubtaskIds())
);
}

private boolean hasMemo(Todo todo, TodoInstance instance) {
String memo = instance != null ? instance.resolveMemo() : todo.getMemo();
return memo != null && !memo.isBlank();
}

private TagResponse mapTag(Tag tag) {
return tag != null ? TagResponse.from(tag) : null;
}
Expand Down
Loading