Skip to content

Commit

Permalink
Merge pull request #392 from mash-up-kr/feature/add-team-api
Browse files Browse the repository at this point in the history
Feature/add team api
  • Loading branch information
kh0712 authored Jan 27, 2024
2 parents 2a7febc + 61d425d commit c409561
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
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"));
}
}

0 comments on commit c409561

Please sign in to comment.