Skip to content

Commit

Permalink
v2.3.3 (#742)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sangwook02 authored Sep 2, 2024
2 parents 5dacd55 + 171694c commit c44c039
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ public class StudentStudyHistoryController {
private final StudentStudyHistoryService studentStudyHistoryService;

@Operation(summary = "레포지토리 입력", description = "레포지토리를 입력합니다. 이미 제출한 과제가 있다면 수정할 수 없습니다.")
@PutMapping("/{studyHistoryId}/repository")
@PutMapping("/{studyId}/repository")
public ResponseEntity<Void> updateRepository(
@PathVariable Long studyHistoryId, @Valid @RequestBody RepositoryUpdateRequest request) throws IOException {
studentStudyHistoryService.updateRepository(studyHistoryId, request);
@PathVariable Long studyId, @Valid @RequestBody RepositoryUpdateRequest request) throws IOException {
studentStudyHistoryService.updateRepository(studyId, request);
return ResponseEntity.ok().build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.gdschongik.gdsc.domain.study.dao.AssignmentHistoryRepository;
import com.gdschongik.gdsc.domain.study.dao.StudyDetailRepository;
import com.gdschongik.gdsc.domain.study.dao.StudyHistoryRepository;
import com.gdschongik.gdsc.domain.study.dao.StudyRepository;
import com.gdschongik.gdsc.domain.study.domain.AssignmentHistory;
import com.gdschongik.gdsc.domain.study.domain.AssignmentHistoryGrader;
import com.gdschongik.gdsc.domain.study.domain.AssignmentSubmissionFetcher;
Expand Down Expand Up @@ -43,14 +44,15 @@ public class StudentStudyHistoryService {
private final StudyHistoryValidator studyHistoryValidator;
private final StudyAssignmentHistoryValidator studyAssignmentHistoryValidator;
private final AssignmentHistoryGrader assignmentHistoryGrader;
private final StudyRepository studyRepository;

@Transactional
public void updateRepository(Long studyHistoryId, RepositoryUpdateRequest request) throws IOException {
public void updateRepository(Long studyId, RepositoryUpdateRequest request) throws IOException {
Member currentMember = memberUtil.getCurrentMember();
Study study = studyRepository.findById(studyId).orElseThrow(() -> new CustomException(STUDY_NOT_FOUND));
StudyHistory studyHistory = studyHistoryRepository
.findById(studyHistoryId)
.findByStudentAndStudy(currentMember, study)
.orElseThrow(() -> new CustomException(STUDY_HISTORY_NOT_FOUND));
Study study = studyHistory.getStudy();

boolean isAnyAssignmentSubmitted =
assignmentHistoryRepository.existsSubmittedAssignmentByMemberAndStudy(currentMember, study);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,17 @@
import com.gdschongik.gdsc.domain.recruitment.domain.vo.Period;
import com.gdschongik.gdsc.domain.study.domain.Difficulty;
import com.gdschongik.gdsc.domain.study.domain.StudyDetail;
import com.gdschongik.gdsc.domain.study.domain.StudyStatus;
import com.gdschongik.gdsc.domain.study.domain.vo.Curriculum;

public record StudyCurriculumResponse(
Long studyDetailId, Period period, Long week, String title, String description, Difficulty difficulty) {
Long studyDetailId,
Period period,
Long week,
String title,
String description,
Difficulty difficulty,
StudyStatus curriculumStatus) {

public static StudyCurriculumResponse from(StudyDetail studyDetail) {
Curriculum curriculum = studyDetail.getCurriculum();
Expand All @@ -16,6 +23,7 @@ public static StudyCurriculumResponse from(StudyDetail studyDetail) {
studyDetail.getWeek(),
curriculum.getTitle(),
curriculum.getDescription(),
curriculum.getDifficulty());
curriculum.getDifficulty(),
curriculum.getStatus());
}
}

0 comments on commit c44c039

Please sign in to comment.