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

feat: 제출 가능한 과제 API 응답에 최종 수정 일시 필드 추가 #762

Merged
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 @@ -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);
}
}