Skip to content

Commit

Permalink
fix: 레포지토리 입력 API path variable 수정 (#735)
Browse files Browse the repository at this point in the history
fix: 레포지토리 입력 api path variable 수정
  • Loading branch information
Sangwook02 authored Sep 2, 2024
1 parent 0d66161 commit 171694c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 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

0 comments on commit 171694c

Please sign in to comment.