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 @@ -24,9 +24,13 @@ public interface TodoRepository extends JpaRepository<Todo, Long> {
@EntityGraph(attributePaths = {"activity"})
List<Todo> findAllByGreenRoomAndUseYn(GreenRoom greenRoom, Boolean useYn);

@EntityGraph(attributePaths = {"activity"})
List<Todo> findAllByGreenRoomAndUseYnAndNextTodoDateIsNotNull(GreenRoom greenRoom, Boolean useYn);

@Query("select t from Todo t where t.greenRoom.greenroomId = :greenroomId and t.activity.activityId in (:activityIds)")
List<Todo> findAllByGreenRoomAndActivity(@Param("greenroomId")Long greenroomId,@Param("activityIds") List<Long> activityIds );

@EntityGraph(attributePaths ={"activity"})
List<Todo> findAllByGreenRoom(GreenRoom greenRoom);

@EntityGraph(attributePaths ={"activity"})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,6 @@ public GreenroomTodoCycleResponseDto updateActivityStatus(ActivityStatusUpdateRe
todoService.createTodo(greenRoom,new ArrayList<>(active));

return getGreenroomTodoInfo(greenroomId);

}

private void updateExistingTodos(List<Todo> todoList, Set<Long> activeIds, Set<Long> inactiveIds) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class TodoService {

public GreenroomInfoResponseDto.GreenroomTodoInfoDto getGreenroomTodoInfo(GreenRoom greenRoom){

List<Todo> greemroomTodoList = todoRepository.findAllByGreenRoomAndUseYn(greenRoom,true);
List<Todo> greemroomTodoList = todoRepository.findAllByGreenRoomAndUseYnAndNextTodoDateIsNotNull(greenRoom,true);

//오늘 해야하는 일인지 확인
Predicate<Todo> isTodo = todo -> !todo.getNextTodoDate().isAfter(LocalDate.now());
Expand Down
2 changes: 0 additions & 2 deletions server/src/test/resources/schema-test.sql
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,6 @@ ALTER TABLE `adornment` ADD FOREIGN KEY (`item_id`) REFERENCES `item` (`item_id`

ALTER TABLE `adornment` ADD FOREIGN KEY (`greenroom_id`) REFERENCES `greenroom` (`greenroom_id`);

ALTER TABLE `suggestion` ADD FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`);

ALTER TABLE `item` ADD FOREIGN KEY (`grade_id`) REFERENCES `grade` (`grade_id`);

ALTER TABLE `notification` ADD FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`);
Expand Down
Loading