Skip to content

[Mod] 스케줄 조회 기능 dto 필드(doneStatus) 추가 #224

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 30, 2025
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 @@ -30,7 +30,7 @@ public class ScheduleController {


// 오늘의 약속 조회
@Operation(summary = "사용자의 툭정 기간 일정 조회",
@Operation(summary = "사용자의 특정 기간 일정 조회",
requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(
description = "기간 JSON 데이터 (startDate와 endDate는 둘 다 선택 사항)"
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package devkor.ontime_back.dto;

import devkor.ontime_back.entity.DoneStatus;
import devkor.ontime_back.entity.Place;
import devkor.ontime_back.entity.User;
import jakarta.persistence.*;
Expand All @@ -22,5 +23,6 @@ public class ScheduleDto {
private Integer scheduleSpareTime;
private String scheduleNote;
private Integer latenessTime;
private DoneStatus doneStatus;

}
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,8 @@ private ScheduleDto mapToDto(Schedule schedule) {
schedule.getScheduleTime(),
(schedule.getScheduleSpareTime() == null) ? schedule.getUser().getSpareTime() : schedule.getScheduleSpareTime(),
schedule.getScheduleNote(),
schedule.getLatenessTime()
schedule.getLatenessTime(),
schedule.getDoneStatus()
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import devkor.ontime_back.ControllerTestSupport;
import devkor.ontime_back.TestSecurityConfig;
import devkor.ontime_back.dto.*;
import devkor.ontime_back.entity.DoneStatus;
import jakarta.servlet.http.HttpServletRequest;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -42,8 +43,8 @@ void getPeriodSchedule_success() throws Exception {
LocalDateTime endDate = LocalDateTime.of(2024, 11, 18, 20, 0);

List<ScheduleDto> mockSchedules = List.of(
new ScheduleDto(UUID.randomUUID(), new PlaceDto(UUID.randomUUID(), "과학도서관"), "공부하기", 10, startDate, 5, "늦으면 안됨", 2),
new ScheduleDto(UUID.randomUUID(), new PlaceDto(UUID.randomUUID(), "중식당"), "가족행사", 15, startDate.plusHours(2), 10, "생신", 0)
new ScheduleDto(UUID.randomUUID(), new PlaceDto(UUID.randomUUID(), "과학도서관"), "공부하기", 10, startDate, 5, "늦으면 안됨", 2, DoneStatus.NORMAL),
new ScheduleDto(UUID.randomUUID(), new PlaceDto(UUID.randomUUID(), "중식당"), "가족행사", 15, startDate.plusHours(2), 10, "생신", 0, DoneStatus.NORMAL)
);
when(userAuthService.getUserIdFromToken(any(HttpServletRequest.class))).thenReturn(userId);
when(scheduleService.showSchedulesByPeriod(userId, startDate, endDate)).thenReturn(mockSchedules);
Expand Down Expand Up @@ -74,7 +75,7 @@ void getScheduleById_success() throws Exception {
Long userId = 1L;
UUID scheduleId = UUID.randomUUID();

ScheduleDto mockSchedule = new ScheduleDto(scheduleId, new PlaceDto(UUID.randomUUID(), "과학도서관"), "공부하기", 10, LocalDateTime.of(2024, 11, 15, 18, 0), 5, "늦으면 안됨", 2);
ScheduleDto mockSchedule = new ScheduleDto(scheduleId, new PlaceDto(UUID.randomUUID(), "과학도서관"), "공부하기", 10, LocalDateTime.of(2024, 11, 15, 18, 0), 5, "늦으면 안됨", 2, DoneStatus.NOT_ENDED);

when(userAuthService.getUserIdFromToken(any(HttpServletRequest.class))).thenReturn(userId);
when(scheduleService.showScheduleByScheduleId(userId, scheduleId)).thenReturn(mockSchedule);
Expand Down