|
| 1 | +package dmu.dasom.api.global.admin.controller; |
| 2 | + |
| 3 | +import dmu.dasom.api.domain.applicant.dto.ApplicantResponseDto; |
| 4 | +import dmu.dasom.api.domain.applicant.service.ApplicantService; |
| 5 | +import dmu.dasom.api.global.dto.PageResponse; |
| 6 | +import io.swagger.v3.oas.annotations.Operation; |
| 7 | +import io.swagger.v3.oas.annotations.media.Content; |
| 8 | +import io.swagger.v3.oas.annotations.media.ExampleObject; |
| 9 | +import io.swagger.v3.oas.annotations.media.Schema; |
| 10 | +import io.swagger.v3.oas.annotations.responses.ApiResponse; |
| 11 | +import io.swagger.v3.oas.annotations.responses.ApiResponses; |
| 12 | +import jakarta.validation.constraints.Min; |
| 13 | +import lombok.RequiredArgsConstructor; |
| 14 | +import org.springframework.http.ResponseEntity; |
| 15 | +import org.springframework.web.ErrorResponse; |
| 16 | +import org.springframework.web.bind.annotation.GetMapping; |
| 17 | +import org.springframework.web.bind.annotation.RequestMapping; |
| 18 | +import org.springframework.web.bind.annotation.RequestParam; |
| 19 | +import org.springframework.web.bind.annotation.RestController; |
| 20 | + |
| 21 | +@RestController |
| 22 | +@RequestMapping("/api/admin") |
| 23 | +@RequiredArgsConstructor |
| 24 | +public class AdminController { |
| 25 | + |
| 26 | + private final ApplicantService applicantService; |
| 27 | + |
| 28 | + // 지원자 조회 |
| 29 | + @Operation(summary = "지원자 조회") |
| 30 | + @ApiResponses(value = { |
| 31 | + @ApiResponse(responseCode = "200", description = "지원자 조회 성공"), |
| 32 | + @ApiResponse(responseCode = "400", description = "잘못된 요청", |
| 33 | + content = @Content( |
| 34 | + mediaType = "application/json", |
| 35 | + schema = @Schema(implementation = ErrorResponse.class), |
| 36 | + examples = { |
| 37 | + @ExampleObject( |
| 38 | + name = "조회 결과 없음", |
| 39 | + value = "{ \"code\": \"C011\", \"message\": \"조회 결과가 없습니다.\" }" |
| 40 | + ) |
| 41 | + } |
| 42 | + ) |
| 43 | + ) |
| 44 | + }) |
| 45 | + @GetMapping("/applicants") |
| 46 | + public ResponseEntity<PageResponse<ApplicantResponseDto>> getApplicants( |
| 47 | + @RequestParam(value = "page", defaultValue = "0") @Min(0) final int page |
| 48 | + ) { |
| 49 | + return ResponseEntity.ok(applicantService.getApplicants(page)); |
| 50 | + } |
| 51 | + |
| 52 | +} |
0 commit comments