-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: 내 할일 목록 API 인터페이스 구현 * feat: 내할일 목록 조회 API 인터페이스 구현 * feat: 내할일 목록 조회 API 추가 * refactor: 변경사항 반영
- Loading branch information
Showing
5 changed files
with
114 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
src/main/java/com/gdschongik/gdsc/domain/study/dto/response/StudyTodoResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package com.gdschongik.gdsc.domain.study.dto.response; | ||
|
||
import static com.gdschongik.gdsc.domain.study.dto.response.StudyTodoResponse.StudyTodoType.ASSIGNMENT; | ||
import static com.gdschongik.gdsc.domain.study.dto.response.StudyTodoResponse.StudyTodoType.ATTENDANCE; | ||
|
||
import com.gdschongik.gdsc.domain.study.domain.AssignmentHistory; | ||
import com.gdschongik.gdsc.domain.study.domain.StudyDetail; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import java.time.LocalDate; | ||
import java.time.LocalDateTime; | ||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
public record StudyTodoResponse( | ||
Long studyDetailId, | ||
@Schema(description = "현 주차수") Long week, | ||
@Schema(description = "할일 타입") StudyTodoType todoType, | ||
@Schema(description = "마감 시각") LocalDateTime deadLine, | ||
@Schema(description = "출석 상태 (출석타입일 때만 사용)") AttendanceStatusResponse attendanceStatus, | ||
@Schema(description = "과제 제목 (과제타입일 때만 사용)") String assignmentTitle, | ||
@Schema(description = "과제 제출 상태 (과제타입일 때만 사용)") AssignmentSubmissionStatusResponse assignmentSubmissionStatus) { | ||
|
||
public static StudyTodoResponse createAttendanceType(StudyDetail studyDetail, LocalDate now, boolean isAttended) { | ||
return new StudyTodoResponse( | ||
studyDetail.getId(), | ||
studyDetail.getWeek(), | ||
ATTENDANCE, | ||
studyDetail.getAttendanceDay().atTime(23, 59, 59), | ||
AttendanceStatusResponse.of(studyDetail, now, isAttended), | ||
null, | ||
null); | ||
} | ||
|
||
public static StudyTodoResponse createAssignmentType(StudyDetail studyDetail, AssignmentHistory assignmentHistory) { | ||
return new StudyTodoResponse( | ||
studyDetail.getId(), | ||
studyDetail.getWeek(), | ||
ASSIGNMENT, | ||
studyDetail.getAssignment().getDeadline(), | ||
null, | ||
studyDetail.getAssignment().getTitle(), | ||
AssignmentSubmissionStatusResponse.from(assignmentHistory)); | ||
} | ||
|
||
@Getter | ||
@RequiredArgsConstructor | ||
public enum StudyTodoType { | ||
ATTENDANCE("출석"), | ||
ASSIGNMENT("과제"); | ||
|
||
private final String value; | ||
} | ||
} |