Skip to content
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

Feature/add team api #392

Merged
merged 2 commits into from
Jan 27, 2024
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
@@ -1,5 +1,8 @@
package kr.mashup.branding.facade.application;

import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;

@RestController
@RequestMapping("/api/v1/applications")
Expand Down Expand Up @@ -127,7 +129,12 @@ public ApiResponse<ApplicationResponse> updateConfirmation(
public ApiResponse<List<RecruitScheduleResponse>> getRecruitSchedule(
@PathVariable Integer generationNumber
){
final List<RecruitScheduleResponse> response = applicationFacadeService.getRecruitSchedule(generationNumber);
final List<RecruitScheduleResponse> response =
applicationFacadeService
.getRecruitSchedule(generationNumber)
.stream()
.sorted(Comparator.comparing(RecruitScheduleResponse::getEventOccurredAt))
.collect(Collectors.toList());

return ApiResponse.success(response);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,29 @@
import lombok.Getter;

import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;

@Getter
@AllArgsConstructor(access = AccessLevel.PRIVATE)
public class RecruitScheduleResponse {

private Long recruitScheduleId;
private RecruitmentScheduleEventName eventName;

private LocalDateTime eventOccurredAt;
private ZonedDateTime eventOccurredAt;

public static RecruitScheduleResponse of(final RecruitmentSchedule schedule){
return new RecruitScheduleResponse(schedule.getRecruitmentScheduleId(), schedule.getEventName(), schedule.getEventOccurredAt());
return new RecruitScheduleResponse(
schedule.getRecruitmentScheduleId(),
schedule.getEventName(),
convertToZonedDateTime(schedule.getEventOccurredAt()));
}


private static ZonedDateTime convertToZonedDateTime(LocalDateTime localDateTime) {
if (localDateTime == null) {
return null;
}
return ZonedDateTime.of(localDateTime, ZoneId.of("Asia/Seoul"));
}
}
Loading