Feat: Todo 생성 API 구현

This commit is contained in:
cyjadela 2025-10-28 13:36:02 +09:00
parent e09ef19d5e
commit cf9b388127
40 changed files with 1656 additions and 11 deletions

File diff suppressed because it is too large Load Diff

View File

@ -7,6 +7,8 @@ import com.unicorn.hgzero.meeting.biz.dto.TodoDTO;
import com.unicorn.hgzero.meeting.biz.usecase.in.todo.*;
import com.unicorn.hgzero.meeting.biz.usecase.out.TodoReader;
import com.unicorn.hgzero.meeting.biz.usecase.out.TodoWriter;
import com.unicorn.hgzero.meeting.biz.usecase.out.MinutesReader;
import com.unicorn.hgzero.meeting.biz.domain.Minutes;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Page;
@ -36,6 +38,7 @@ public class TodoService implements
private final TodoReader todoReader;
private final TodoWriter todoWriter;
private final MinutesReader minutesReader;
/**
* Todo 생성
@ -45,6 +48,14 @@ public class TodoService implements
public Todo createTodo(CreateTodoCommand command) {
log.info("Creating todo: {}", command.title());
// minutesId로 meetingId 조회
String meetingId = command.meetingId();
if (meetingId == null && command.minutesId() != null) {
Minutes minutes = minutesReader.findById(command.minutesId())
.orElseThrow(() -> new BusinessException(ErrorCode.ENTITY_NOT_FOUND, "회의록을 찾을 수 없습니다."));
meetingId = minutes.getMeetingId();
}
// Todo ID 생성
String todoId = UUID.randomUUID().toString();
@ -52,7 +63,7 @@ public class TodoService implements
Todo todo = Todo.builder()
.todoId(todoId)
.minutesId(command.minutesId())
.meetingId(command.meetingId())
.meetingId(meetingId)
.title(command.title())
.description(command.description())
.assigneeId(command.assigneeId())

View File

@ -63,16 +63,16 @@ public class TodoController {
userId, request.getMinutesId(), request.getTitle(), request.getAssigneeId());
try {
// Todo 생성
// Todo 생성 (description은 null, priority는 기본값 MEDIUM 사용)
Todo createdTodo = todoService.createTodo(
new CreateTodoUseCase.CreateTodoCommand(
request.getMinutesId(),
null, // meetingId는 나중에 회의록에서 가져올 예정
null, // meetingId는 회의록에서 가져올 예정
request.getTitle(),
request.getDescription(),
null, // description 제거
request.getAssigneeId(),
request.getDueDate(),
request.getPriority()
"MEDIUM" // priority 기본값
)
);

View File

@ -26,9 +26,6 @@ public class CreateTodoRequest {
@Size(max = 100, message = "Todo 제목은 100자 이내여야 합니다")
private String title;
@Size(max = 500, message = "Todo 설명은 500자 이내여야 합니다")
private String description;
@NotBlank(message = "담당자 ID는 필수입니다")
private String assigneeId;
@ -37,7 +34,4 @@ public class CreateTodoRequest {
@NotNull(message = "예정 완료일은 필수입니다")
private LocalDate dueDate;
@NotBlank(message = "우선순위는 필수입니다")
private String priority; // HIGH, MEDIUM, LOW
}

View File

@ -0,0 +1,8 @@
-- V3__add_assignee_name_to_todos.sql
-- todos 테이블에 assignee_name 컬럼 추가
ALTER TABLE todos
ADD COLUMN assignee_name VARCHAR(100);
-- 기존 데이터에 대한 기본값 설정 (필요시)
UPDATE todos SET assignee_name = 'Unknown' WHERE assignee_name IS NULL;