Skip to content

Commit

Permalink
Merge pull request #116 from 22caps/dev
Browse files Browse the repository at this point in the history
고메인
  • Loading branch information
GiHoo authored Oct 28, 2024
2 parents de22d32 + ca2cc02 commit df983de
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,6 @@ public interface SolveHistoryService {
List<SolveHistoryReviewResponseDto> reviewSolveHistory(Long id, Long solveHistoryId);

SubmissionResponseDto submitReviewSolveHistory(SolveHistoryReviewRequestDto request);

SubmissionResponseDto submitPluginSolveHistory(SolveHistoryDetailRequestDto request);
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,16 @@ public SubmissionResponseDto submitSolveHistory(SolveHistoryDetailRequestDto req
return SubmissionResponseDto.of(isCorrect, problem.getAnswer());
}

@Override
public SubmissionResponseDto submitPluginSolveHistory(SolveHistoryDetailRequestDto request) {
Problem problem = problemRepository.findById(request.getProblemId())
.orElseThrow(() -> ProblemExistsException.of(ProblemErrorCode.PROBLEM_IS_NOT_EXISTS));

boolean isCorrect = isCorrectAnswer(problem.getAnswer(), request.getUserAnswer());

return SubmissionResponseDto.of(isCorrect, problem.getAnswer());
}

@Override
public List<SolveHistoryResponseDto> getHistoryList(Long memberId) {
return convertSolveHistoryEntityToDto(solveHistoryRepository.findByMemberIdAndIsCompletedIsTrue(memberId));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ public SubmissionResponseDto submitSolveHistory(
return solveHistoryService.submitSolveHistory(request, member.getId());
}

@GetMapping("/plugin-submit")
@Operation(summary = "문제 풀이 기록 제출", description = "문제 풀이 기록을 제출합니다. 사용자는 모든 문제를 푼 후에 제출할 수 있습니다.")
@ApiResponse(responseCode = "200", description = "문제 풀이 기록 제출 성공")
public SubmissionResponseDto submitSolveHistory(
@RequestBody SolveHistoryDetailRequestDto request) {
return solveHistoryService.submitPluginSolveHistory(request);
}

@GetMapping("/list")
@Operation(summary = "문제 풀이 기록 전체 조회", description = "사용자의 문제 풀이 기록을 조회합니다. 풀이 완료가 된 문제들만 조회 가능합니다.")
@ApiResponse(responseCode = "200", description = "문제 풀이 기록 전체 조회 성공")
Expand Down

0 comments on commit df983de

Please sign in to comment.