diff --git a/src/main/java/mvc/promiseme/project/entity/Project.java b/src/main/java/mvc/promiseme/project/entity/Project.java index ba9a1d8..3ef24a5 100644 --- a/src/main/java/mvc/promiseme/project/entity/Project.java +++ b/src/main/java/mvc/promiseme/project/entity/Project.java @@ -29,17 +29,17 @@ public class Project { @GeneratedValue(strategy = GenerationType.IDENTITY) private Long projectId; - @Column(nullable = false, length = 50) + @Column(length = 50) private String name; @Column(nullable = false) @Enumerated(EnumType.STRING) private Progress isProgress; - @Column(nullable = false, length = 50) + @Column(length = 50) private String category; - @Column(nullable = false, length = 100) + @Column(length = 100) private String topic; private LocalDate start; diff --git a/src/main/java/mvc/promiseme/project/repository/ProjectRepository.java b/src/main/java/mvc/promiseme/project/repository/ProjectRepository.java index 10bb97b..23fbfa0 100644 --- a/src/main/java/mvc/promiseme/project/repository/ProjectRepository.java +++ b/src/main/java/mvc/promiseme/project/repository/ProjectRepository.java @@ -11,7 +11,7 @@ public interface ProjectRepository extends JpaRepository { - @Query("SELECT CAST((SELECT COUNT(t1) FROM Todo t1 WHERE t1.project.id = :projectId AND t1.isCompleted = 'COMPLETE') / COUNT(t2) * 100 AS INTEGER) " + + @Query("SELECT CAST((SELECT COUNT(t1) FROM Todo t1 WHERE t1.project.id = :projectId AND t1.isCompleted = true) / COUNT(t2) * 100 AS INTEGER) " + "FROM Todo t2 WHERE t2.project.id = :projectId") int getProgress(@Param("projectId") Long projecrtId); @Query("SELECT datediff(p.deadline, now()) From Project p where p.projectId = :projectId") diff --git a/src/main/java/mvc/promiseme/todo/dto/TodoResponseDTO.java b/src/main/java/mvc/promiseme/todo/dto/TodoResponseDTO.java index c168b01..463a2f0 100644 --- a/src/main/java/mvc/promiseme/todo/dto/TodoResponseDTO.java +++ b/src/main/java/mvc/promiseme/todo/dto/TodoResponseDTO.java @@ -1,7 +1,6 @@ package mvc.promiseme.todo.dto; import lombok.*; -import mvc.promiseme.todo.entity.ToDoStatus; import mvc.promiseme.todo.entity.Todo; import java.util.List; @@ -16,7 +15,7 @@ public class TodoResponseDTO { private Long todoId; private String content; - private ToDoStatus isCompleted; + private boolean isCompleted; public List convertToDtoList(List todoList) { return todoList.stream() @@ -28,7 +27,7 @@ private TodoResponseDTO convertToDto(Todo todo) { return TodoResponseDTO.builder() .todoId(todo.getToDoId()) .content(todo.getContent()) - .isCompleted(todo.getIsCompleted()) + .isCompleted(todo.isCompleted()) .build(); } } diff --git a/src/main/java/mvc/promiseme/todo/entity/ToDoStatus.java b/src/main/java/mvc/promiseme/todo/entity/ToDoStatus.java deleted file mode 100644 index 26da147..0000000 --- a/src/main/java/mvc/promiseme/todo/entity/ToDoStatus.java +++ /dev/null @@ -1,13 +0,0 @@ -package mvc.promiseme.todo.entity; - -import lombok.AllArgsConstructor; -import lombok.Getter; - -@AllArgsConstructor -@Getter -public enum ToDoStatus { - INCOMPLETE("미완료"), - COMPLETE("완료"); - - private String value; -} diff --git a/src/main/java/mvc/promiseme/todo/entity/Todo.java b/src/main/java/mvc/promiseme/todo/entity/Todo.java index 3ea46ca..cbf3897 100644 --- a/src/main/java/mvc/promiseme/todo/entity/Todo.java +++ b/src/main/java/mvc/promiseme/todo/entity/Todo.java @@ -23,9 +23,8 @@ public class Todo { private String content; @Column(nullable = false) - @Enumerated(EnumType.STRING) @Builder.Default - private ToDoStatus isCompleted = ToDoStatus.INCOMPLETE; + private boolean isCompleted = false; private LocalDate todoDate; private LocalDate createdAt; diff --git a/src/main/java/mvc/promiseme/todo/service/TodoServiceImpl.java b/src/main/java/mvc/promiseme/todo/service/TodoServiceImpl.java index 991192e..2033ba9 100644 --- a/src/main/java/mvc/promiseme/todo/service/TodoServiceImpl.java +++ b/src/main/java/mvc/promiseme/todo/service/TodoServiceImpl.java @@ -7,7 +7,6 @@ import mvc.promiseme.project.repository.ProjectRepository; import mvc.promiseme.todo.dto.TodoRequestDTO; import mvc.promiseme.todo.dto.TodoResponseDTO; -import mvc.promiseme.todo.entity.ToDoStatus; import mvc.promiseme.todo.entity.Todo; import mvc.promiseme.todo.repository.TodoRepository; import mvc.promiseme.users.entity.Users; @@ -54,9 +53,8 @@ public String check(Long todoId){ } private Todo updateStatus(Todo todo){ - ToDoStatus status = todo.getIsCompleted(); - if(status.equals(ToDoStatus.COMPLETE)) todo.setIsCompleted(ToDoStatus.INCOMPLETE); - else if (status.equals(ToDoStatus.INCOMPLETE)) todo.setIsCompleted(ToDoStatus.COMPLETE); + if(todo.isCompleted() == true) todo.setCompleted(false); + else if (todo.isCompleted() == false) todo.setCompleted(true); return todo; }