Skip to content

Commit

Permalink
feat: 제출 가능한 과제 API 응답에 최종 수정 일시 필드 추가 (#762)
Browse files Browse the repository at this point in the history
* feat: 제출 가능한 과제 api 응답에 최종 수정 일시 필드 추가

* feat: api에 deprecated 어노테이션 추가
  • Loading branch information
Sangwook02 authored Sep 4, 2024
1 parent d304af7 commit 7292f33
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public ResponseEntity<List<StudyStudentCurriculumResponse>> getStudyCurriculums(
return ResponseEntity.ok(response);
}

@Deprecated
@Operation(summary = "이번주 제출해야 할 과제 조회", description = "마감 기한이 이번주까지인 과제를 조회합니다.")
@GetMapping("/assignments/upcoming")
public ResponseEntity<List<AssignmentHistoryStatusResponse>> getUpcomingAssignments(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ public record AssignmentSubmittableDto(
@Nullable @Schema(description = "과제 명세 링크") String descriptionLink,
@Nullable @Schema(description = "마감 기한") LocalDateTime deadline,
@Nullable @Schema(description = "과제 제출 링크") String submissionLink,
@Nullable @Schema(description = "과제 제출 실패 사유") SubmissionFailureType submissionFailureType) {
@Nullable @Schema(description = "과제 제출 실패 사유") SubmissionFailureType submissionFailureType,
@Nullable @Schema(description = "최종 수정 일시") LocalDateTime committedAt) {
public static AssignmentSubmittableDto of(StudyDetail studyDetail, AssignmentHistory assignmentHistory) {
Assignment assignment = studyDetail.getAssignment();

Expand All @@ -40,12 +41,22 @@ public static AssignmentSubmittableDto of(StudyDetail studyDetail, AssignmentHis
assignment.getDescriptionLink(),
assignment.getDeadline(),
assignmentHistory.getSubmissionLink(),
assignmentHistory.getSubmissionFailureType());
assignmentHistory.getSubmissionFailureType(),
assignmentHistory.getCommittedAt());
}

private static AssignmentSubmittableDto cancelledAssignment(StudyDetail studyDetail, Assignment assignment) {
return new AssignmentSubmittableDto(
studyDetail.getId(), assignment.getStatus(), studyDetail.getWeek(), null, null, null, null, null, null);
studyDetail.getId(),
assignment.getStatus(),
studyDetail.getWeek(),
null,
null,
null,
null,
null,
null,
null);
}

private static AssignmentSubmittableDto beforeAssignmentSubmit(StudyDetail studyDetail, Assignment assignment) {
Expand All @@ -58,6 +69,7 @@ private static AssignmentSubmittableDto beforeAssignmentSubmit(StudyDetail study
assignment.getDescriptionLink(),
assignment.getDeadline(),
null,
null,
null);
}
}

0 comments on commit 7292f33

Please sign in to comment.