Skip to content

Commit

Permalink
merge: 일정 등록 및 조회 API에 userId 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
yh0921k authored Sep 16, 2023
2 parents f663cbe + 543a830 commit 1d0ca7b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public class ScheduleService {
public CreateScheduleResponse createSchedule(CreateScheduleRequest request) {
Schedule schedule =
Schedule.builder()
.userId(request.getUserId())
.startedAt(request.getStartedAt())
.finishedAt(request.getFinishedAt())
.title(request.getTitle())
Expand All @@ -29,6 +30,7 @@ public CreateScheduleResponse createSchedule(CreateScheduleRequest request) {

return CreateScheduleResponse.builder()
.id(savedSchedule.getId())
.userId(savedSchedule.getUserId())
.startedAt(savedSchedule.getStartedAt())
.finishedAt(savedSchedule.getFinishedAt())
.title(savedSchedule.getTitle())
Expand All @@ -45,6 +47,7 @@ public List<CreateScheduleResponse> getSchedules() {
schedule ->
CreateScheduleResponse.builder()
.id(schedule.getId())
.userId(schedule.getUserId())
.startedAt(schedule.getStartedAt())
.finishedAt(schedule.getFinishedAt())
.title(schedule.getTitle())
Expand All @@ -61,6 +64,7 @@ public CreateScheduleResponse getScheduleById(Long id) {

return CreateScheduleResponse.builder()
.id(schedule.getId())
.userId(schedule.getUserId())
.startedAt(schedule.getStartedAt())
.finishedAt(schedule.getFinishedAt())
.title(schedule.getTitle())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
@Getter
@Setter
public class CreateScheduleRequest {
private Long userId;

@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime startedAt;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
public class CreateScheduleResponse {
private Long id;

private Long userId;

@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime startedAt;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ void createSchedule() {

// then
assertThat(response.getId()).isEqualTo(1L);
assertThat(response.getUserId()).isEqualTo(schedule.getUserId());
assertThat(response.getStartedAt()).isEqualTo(schedule.getStartedAt());
assertThat(response.getFinishedAt()).isEqualTo(schedule.getFinishedAt());
assertThat(response.getTitle()).isEqualTo(schedule.getTitle());
Expand Down Expand Up @@ -80,6 +81,7 @@ void getScheduleById() {

// then
assertThat(response.getId()).isEqualTo(schedule.getId());
assertThat(response.getUserId()).isEqualTo(schedule.getUserId());
assertThat(response.getStartedAt()).isEqualTo(schedule.getStartedAt());
assertThat(response.getFinishedAt()).isEqualTo(schedule.getFinishedAt());
assertThat(response.getTitle()).isEqualTo(schedule.getTitle());
Expand Down Expand Up @@ -130,6 +132,7 @@ private CreateScheduleRequest createScheduleRequest() {
"2023-08-27 00:00:00", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));

CreateScheduleRequest request = new CreateScheduleRequest();
request.setUserId(1L);
request.setStartedAt(startedAt);
request.setFinishedAt(finishedAt);
request.setTitle("Title");
Expand Down

0 comments on commit 1d0ca7b

Please sign in to comment.