|
| 1 | +package com.moplus.moplus_server.client.submit.controller; |
| 2 | + |
| 3 | +import com.moplus.moplus_server.client.submit.domain.ChildProblemSubmitStatus; |
| 4 | +import com.moplus.moplus_server.client.submit.domain.ProblemSubmitStatus; |
| 5 | +import com.moplus.moplus_server.client.submit.dto.request.ChildProblemSubmitCreateRequest; |
| 6 | +import com.moplus.moplus_server.client.submit.dto.request.ChildProblemSubmitUpdateIncorrectRequest; |
| 7 | +import com.moplus.moplus_server.client.submit.dto.request.ChildProblemSubmitUpdateRequest; |
| 8 | +import com.moplus.moplus_server.client.submit.dto.request.ProblemSubmitCreateRequest; |
| 9 | +import com.moplus.moplus_server.client.submit.dto.request.ProblemSubmitUpdateRequest; |
| 10 | +import com.moplus.moplus_server.client.submit.service.ClientSubmitService; |
| 11 | +import io.swagger.v3.oas.annotations.Operation; |
| 12 | +import io.swagger.v3.oas.annotations.tags.Tag; |
| 13 | +import lombok.RequiredArgsConstructor; |
| 14 | +import org.springframework.http.ResponseEntity; |
| 15 | +import org.springframework.web.bind.annotation.PostMapping; |
| 16 | +import org.springframework.web.bind.annotation.PutMapping; |
| 17 | +import org.springframework.web.bind.annotation.RequestBody; |
| 18 | +import org.springframework.web.bind.annotation.RequestMapping; |
| 19 | +import org.springframework.web.bind.annotation.RestController; |
| 20 | + |
| 21 | +@Tag(name = "클라이언트 제출", description = "클라이언트 제출 관련 API") |
| 22 | +@RestController |
| 23 | +@RequestMapping("/api/v1/client") |
| 24 | +@RequiredArgsConstructor |
| 25 | +public class ClientSubmitController { |
| 26 | + |
| 27 | + private final ClientSubmitService clientSubmitService; |
| 28 | + |
| 29 | + @PostMapping("problemSubmit") |
| 30 | + @Operation(summary = "문항 제출 생성", description = "문항 제출을 '진행중'으로 생성합니다.") |
| 31 | + public ResponseEntity<Void> createProblemSubmit( |
| 32 | + @RequestBody ProblemSubmitCreateRequest request |
| 33 | + ) { |
| 34 | + clientSubmitService.createProblemSubmit(request); |
| 35 | + return ResponseEntity.ok(null); |
| 36 | + } |
| 37 | + |
| 38 | + @PutMapping("problemSubmit") |
| 39 | + @Operation(summary = "문항 제출 업데이트", description = "제출한 답안을 바탕으로 문항 제출의 상태를 업데이트합니다.") |
| 40 | + public ResponseEntity<ProblemSubmitStatus> updateProblemSubmit( |
| 41 | + @RequestBody ProblemSubmitUpdateRequest request |
| 42 | + ) { |
| 43 | + return ResponseEntity.ok(clientSubmitService.updateProblemSubmit(request)); |
| 44 | + } |
| 45 | + |
| 46 | + @PostMapping("childProblemSubmit") |
| 47 | + @Operation(summary = "새끼문항 제출 생성", description = "문항에 속한 새끼문항들을 '시작전'으로 생성합니다.") |
| 48 | + public ResponseEntity<Void> createProblemSubmit( |
| 49 | + @RequestBody ChildProblemSubmitCreateRequest request |
| 50 | + ) { |
| 51 | + clientSubmitService.createChildProblemSubmit(request); |
| 52 | + return ResponseEntity.ok(null); |
| 53 | + } |
| 54 | + |
| 55 | + @PutMapping("childProblemSubmit") |
| 56 | + @Operation(summary = "새끼문항 제출 업데이트", description = "제출한 답안을 바탕으로 문항 제출의 상태를 업데이트합니다.") |
| 57 | + public ResponseEntity<ChildProblemSubmitStatus> updateChildProblemSubmit( |
| 58 | + @RequestBody ChildProblemSubmitUpdateRequest request |
| 59 | + ) { |
| 60 | + return ResponseEntity.ok(clientSubmitService.updateChildProblemSubmit(request)); |
| 61 | + } |
| 62 | + |
| 63 | + @PutMapping("childProblemSubmit/incorrect") |
| 64 | + @Operation(summary = "새끼문항 제출 틀림 업데이트", description = "새끼문항 제출의 상태를 틀림으로 업데이트합니다.") |
| 65 | + public ResponseEntity<Void> updateChildProblemSubmitIncorrect( |
| 66 | + @RequestBody ChildProblemSubmitUpdateIncorrectRequest request |
| 67 | + ) { |
| 68 | + clientSubmitService.updateChildProblemSubmitIncorrect(request); |
| 69 | + return ResponseEntity.ok(null); |
| 70 | + } |
| 71 | +} |
0 commit comments