Skip to content
Open
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 @@ -151,6 +151,7 @@ private Long saveSingleTodo(NlpReqDTO.ConfirmItem item, Member member) {
dueTime,
item.isAllDay(),
null, // priority: NLP에서 파싱하지 않음, 기본값 사용
null, // color: 기본값 사용
null // memo
);

Expand Down Expand Up @@ -180,6 +181,7 @@ private Long saveRecurringTodo(NlpReqDTO.ConfirmItem item, Member member) {
dueTime,
item.isAllDay(),
null, // priority
null, // color
null, // memo
group
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.project.backend.domain.todo.entity.TodoRecurrenceException;
import com.project.backend.domain.todo.entity.TodoRecurrenceGroup;
import com.project.backend.domain.todo.enums.Priority;
import com.project.backend.domain.todo.enums.TodoColor;
import com.project.backend.global.recurrence.util.RecurrenceUtils;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
Expand All @@ -31,6 +32,7 @@ public static Todo toTodo(TodoReqDTO.CreateTodo reqDTO, Member member, TodoRecur
.dueTime(reqDTO.dueTime())
.isAllDay(reqDTO.isAllDay() != null ? reqDTO.isAllDay() : false)
.priority(reqDTO.priority() != null ? reqDTO.priority() : Priority.MEDIUM)
.color(reqDTO.color() != null ? reqDTO.color() : TodoColor.BLUE)
.memo(reqDTO.memo())
.member(member)
.todoRecurrenceGroup(todoRecurrenceGroup)
Expand Down Expand Up @@ -95,6 +97,7 @@ public static TodoResDTO.TodoInfo toTodoInfo(Todo todo) {
.dueTime(todo.getDueTime())
.isAllDay(todo.getIsAllDay())
.priority(todo.getPriority())
.color(todo.getColor())
.memo(todo.getMemo())
.isCompleted(todo.getIsCompleted())
.isRecurring(todo.isRecurring())
Expand All @@ -118,6 +121,7 @@ public static TodoResDTO.TodoInfo toTodoInfo(Todo todo, LocalDate occurrenceDate
.dueTime(exception.getDueTime() != null ? exception.getDueTime() : todo.getDueTime())
.isAllDay(todo.getIsAllDay())
.priority(exception.getPriority() != null ? exception.getPriority() : todo.getPriority())
.color(exception.getColor() != null ? exception.getColor() : todo.getColor())
.memo(exception.getMemo() != null ? exception.getMemo() : todo.getMemo())
.isCompleted(exception.getIsCompleted())
.isRecurring(true)
Expand All @@ -137,6 +141,7 @@ public static TodoResDTO.TodoListItem toTodoListItem(Todo todo, LocalDate occurr
.dueTime(todo.getDueTime())
.isAllDay(todo.getIsAllDay())
.priority(todo.getPriority())
.color(todo.getColor())
.memo(todo.getMemo())
.isCompleted(isCompleted != null ? isCompleted : todo.getIsCompleted())
.isRecurring(todo.isRecurring())
Expand All @@ -159,6 +164,7 @@ public static TodoResDTO.TodoListItem toTodoListItem(Todo todo, LocalDate occurr
.dueTime(exception.getDueTime() != null ? exception.getDueTime() : todo.getDueTime())
.isAllDay(todo.getIsAllDay())
.priority(exception.getPriority() != null ? exception.getPriority() : todo.getPriority())
.color(exception.getColor() != null ? exception.getColor() : todo.getColor())
.memo(exception.getMemo() != null ? exception.getMemo() : todo.getMemo())
.isCompleted(exception.getIsCompleted())
.isRecurring(true)
Expand All @@ -176,6 +182,7 @@ public static TodoResDTO.TodoDetailRes toTodoDetailRes(Todo todo, LocalDate occu
.dueTime(todo.getDueTime())
.isAllDay(todo.getIsAllDay())
.priority(todo.getPriority())
.color(todo.getColor())
.memo(todo.getMemo())
.isCompleted(todo.getIsCompleted())
.isRecurring(todo.isRecurring())
Expand All @@ -201,6 +208,7 @@ public static TodoResDTO.TodoDetailRes toTodoDetailRes(Todo todo, LocalDate occu
.dueTime(exception.getDueTime() != null ? exception.getDueTime() : todo.getDueTime())
.isAllDay(todo.getIsAllDay())
.priority(exception.getPriority() != null ? exception.getPriority() : todo.getPriority())
.color(exception.getColor() != null ? exception.getColor() : todo.getColor())
.memo(exception.getMemo() != null ? exception.getMemo() : todo.getMemo())
.isCompleted(exception.getIsCompleted())
.isRecurring(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.project.backend.domain.event.enums.RecurrenceEndType;
import com.project.backend.domain.event.enums.RecurrenceFrequency;
import com.project.backend.domain.todo.enums.Priority;
import com.project.backend.domain.todo.enums.TodoColor;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
Expand Down Expand Up @@ -35,6 +36,8 @@ public record CreateTodo(
@NotNull(message = "우선순위는 필수입니다.")
Priority priority,

TodoColor color,

String memo,

@Valid
Expand Down Expand Up @@ -85,6 +88,8 @@ public record UpdateTodo(

Priority priority,

TodoColor color,

String memo,

@Valid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.project.backend.domain.event.enums.RecurrenceEndType;
import com.project.backend.domain.event.enums.RecurrenceFrequency;
import com.project.backend.domain.todo.enums.Priority;
import com.project.backend.domain.todo.enums.TodoColor;
import lombok.Builder;

import java.time.DayOfWeek;
Expand All @@ -26,6 +27,7 @@ public record TodoInfo(
LocalTime dueTime,
Boolean isAllDay,
Priority priority,
TodoColor color,
String memo,
Boolean isCompleted,
Boolean isRecurring,
Expand All @@ -43,6 +45,7 @@ public record TodoListItem(
LocalTime dueTime,
Boolean isAllDay,
Priority priority,
TodoColor color,
String memo,
Boolean isCompleted,
Boolean isRecurring
Expand All @@ -67,6 +70,7 @@ public record TodoDetailRes(
LocalTime dueTime,
Boolean isAllDay,
Priority priority,
TodoColor color,
String memo,
Boolean isCompleted,
Boolean isRecurring,
Expand Down
13 changes: 12 additions & 1 deletion src/main/java/com/project/backend/domain/todo/entity/Todo.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.project.backend.domain.member.entity.Member;
import com.project.backend.domain.todo.enums.Priority;
import com.project.backend.domain.todo.enums.TodoColor;
import com.project.backend.global.entity.BaseEntity;
import jakarta.persistence.*;
import lombok.*;
Expand Down Expand Up @@ -39,6 +40,11 @@ public class Todo extends BaseEntity {
@Column(name = "priority", nullable = false, length = 10)
private Priority priority = Priority.MEDIUM;

@Builder.Default
@Enumerated(EnumType.STRING)
@Column(name = "color", nullable = false, length = 10)
private TodoColor color = TodoColor.BLUE;

@Column(name = "memo")
private String memo;

Expand Down Expand Up @@ -84,12 +90,13 @@ public void incomplete() {
* 할 일 정보 수정
*/
public void update(String title, LocalDate startDate, LocalTime dueTime,
Boolean isAllDay, Priority priority, String memo) {
Boolean isAllDay, Priority priority, TodoColor color, String memo) {
if (title != null) this.title = title;
if (startDate != null) this.startDate = startDate;
this.dueTime = dueTime;
if (isAllDay != null) this.isAllDay = isAllDay;
if (priority != null) this.priority = priority;
if (color != null) this.color = color;
this.memo = memo;
}

Expand All @@ -112,6 +119,7 @@ public static Todo createSingle(
LocalTime dueTime,
Boolean isAllDay,
Priority priority,
TodoColor color,
String memo
) {
return Todo.builder()
Expand All @@ -121,6 +129,7 @@ public static Todo createSingle(
.dueTime(dueTime)
.isAllDay(isAllDay != null ? isAllDay : false)
.priority(priority != null ? priority : Priority.MEDIUM)
.color(color != null ? color : TodoColor.BLUE)
.memo(memo)
.isCompleted(false)
.build();
Expand All @@ -136,6 +145,7 @@ public static Todo createRecurring(
LocalTime dueTime,
Boolean isAllDay,
Priority priority,
TodoColor color,
String memo,
TodoRecurrenceGroup todoRecurrenceGroup
) {
Expand All @@ -146,6 +156,7 @@ public static Todo createRecurring(
.dueTime(dueTime)
.isAllDay(isAllDay != null ? isAllDay : false)
.priority(priority != null ? priority : Priority.MEDIUM)
.color(color != null ? color : TodoColor.BLUE)
.memo(memo)
.isCompleted(false)
.todoRecurrenceGroup(todoRecurrenceGroup)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.project.backend.domain.event.enums.ExceptionType;
import com.project.backend.domain.todo.enums.Priority;
import com.project.backend.domain.todo.enums.TodoColor;
import jakarta.persistence.*;
import lombok.*;

Expand Down Expand Up @@ -45,6 +46,10 @@ public class TodoRecurrenceException {
@Column(name = "priority", length = 10)
private Priority priority;

@Enumerated(EnumType.STRING)
@Column(name = "color", length = 10)
private TodoColor color;

@Column(name = "memo")
private String memo;
// ==============================
Expand Down Expand Up @@ -77,11 +82,12 @@ public void incomplete() {
/**
* OVERRIDE 예외 정보 수정
*/
public void updateOverride(String title, LocalTime dueTime, Priority priority, String memo) {
public void updateOverride(String title, LocalTime dueTime, Priority priority, TodoColor color, String memo) {
this.exceptionType = ExceptionType.OVERRIDE;
this.title = title;
this.dueTime = dueTime;
this.priority = priority;
this.color = color;
this.memo = memo;
}

Expand Down Expand Up @@ -111,6 +117,7 @@ public static TodoRecurrenceException createOverride(
String title,
LocalTime dueTime,
Priority priority,
TodoColor color,
String memo
) {
return TodoRecurrenceException.builder()
Expand All @@ -120,6 +127,7 @@ public static TodoRecurrenceException createOverride(
.title(title)
.dueTime(dueTime)
.priority(priority)
.color(color)
.memo(memo)
.isCompleted(false)
.build();
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/com/project/backend/domain/todo/enums/TodoColor.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.project.backend.domain.todo.enums;

public enum TodoColor {
BLUE,
GREEN,
PINK,
PURPLE,
GRAY,
YELLOW
}
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ private void updateSingleTodo(Todo todo, TodoReqDTO.UpdateTodo reqDTO) {
reqDTO.dueTime(),
reqDTO.isAllDay(),
reqDTO.priority(),
reqDTO.color(),
reqDTO.memo()
);
log.debug("단일 할 일 수정 완료 - todoId: {}", todo.getId());
Expand Down Expand Up @@ -235,10 +236,12 @@ private TodoResDTO.TodoInfo updateThisTodoOnly(Todo todo, LocalDate occurrenceDa
: (existingException.getDueTime() != null ? existingException.getDueTime() : todo.getDueTime());
com.project.backend.domain.todo.enums.Priority newPriority = reqDTO.priority() != null ? reqDTO.priority()
: (existingException.getPriority() != null ? existingException.getPriority() : todo.getPriority());
com.project.backend.domain.todo.enums.TodoColor newColor = reqDTO.color() != null ? reqDTO.color()
: (existingException.getColor() != null ? existingException.getColor() : todo.getColor());
String newMemo = reqDTO.memo() != null ? reqDTO.memo()
: (existingException.getMemo() != null ? existingException.getMemo() : todo.getMemo());

existingException.updateOverride(newTitle, newDueTime, newPriority, newMemo);
existingException.updateOverride(newTitle, newDueTime, newPriority, newColor, newMemo);
exception = existingException;
log.debug("반복 할 일 예외 수정 완료 (업데이트) - todoId: {}, date: {}", todo.getId(), occurrenceDate);
} else {
Expand All @@ -249,6 +252,7 @@ private TodoResDTO.TodoInfo updateThisTodoOnly(Todo todo, LocalDate occurrenceDa
reqDTO.title() != null ? reqDTO.title() : todo.getTitle(),
reqDTO.dueTime() != null ? reqDTO.dueTime() : todo.getDueTime(),
reqDTO.priority() != null ? reqDTO.priority() : todo.getPriority(),
reqDTO.color() != null ? reqDTO.color() : todo.getColor(),
reqDTO.memo() != null ? reqDTO.memo() : todo.getMemo()
);
todoRecurrenceExceptionRepository.save(exception);
Expand Down Expand Up @@ -294,6 +298,7 @@ private TodoResDTO.TodoInfo updateThisAndFollowing(Todo todo, LocalDate occurren
reqDTO.dueTime() != null ? reqDTO.dueTime() : todo.getDueTime(),
reqDTO.isAllDay() != null ? reqDTO.isAllDay() : todo.getIsAllDay(),
reqDTO.priority() != null ? reqDTO.priority() : todo.getPriority(),
reqDTO.color() != null ? reqDTO.color() : todo.getColor(),
reqDTO.memo() != null ? reqDTO.memo() : todo.getMemo(),
newGroup
);
Expand All @@ -319,6 +324,7 @@ private TodoResDTO.TodoInfo updateAllTodos(Todo todo, TodoReqDTO.UpdateTodo reqD
reqDTO.dueTime(),
reqDTO.isAllDay(),
reqDTO.priority(),
reqDTO.color(),
reqDTO.memo()
);

Expand Down