|
| 1 | +package hs.kr.entrydsm.user.global.document.admin |
| 2 | + |
| 3 | +import hs.kr.entrydsm.user.domain.admin.adapter.`in`.web.dto.request.AdminLoginRequest |
| 4 | +import hs.kr.entrydsm.user.domain.admin.adapter.`in`.web.dto.response.InternalAdminResponse |
| 5 | +import hs.kr.entrydsm.user.global.utils.token.dto.TokenResponse |
| 6 | +import io.swagger.v3.oas.annotations.Operation |
| 7 | +import io.swagger.v3.oas.annotations.Parameter |
| 8 | +import io.swagger.v3.oas.annotations.media.Content |
| 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 io.swagger.v3.oas.annotations.security.SecurityRequirement |
| 13 | +import io.swagger.v3.oas.annotations.tags.Tag |
| 14 | +import jakarta.validation.Valid |
| 15 | +import org.springframework.web.bind.annotation.PathVariable |
| 16 | +import org.springframework.web.bind.annotation.RequestBody |
| 17 | +import org.springframework.web.bind.annotation.RequestHeader |
| 18 | +import java.util.UUID |
| 19 | + |
| 20 | +/** |
| 21 | + * 관리자 API 문서화를 위한 인터페이스입니다. |
| 22 | + */ |
| 23 | +@Tag(name = "Admin", description = "관리자 API") |
| 24 | +interface AdminApiDocument { |
| 25 | + /** |
| 26 | + * 관리자 로그인을 처리합니다. |
| 27 | + */ |
| 28 | + @Operation( |
| 29 | + summary = "관리자 로그인", |
| 30 | + description = "관리자 ID와 비밀번호로 로그인하여 JWT 토큰을 발급받습니다. 성공 시 UserInfo도 Redis에 저장됩니다.", |
| 31 | + ) |
| 32 | + @ApiResponses( |
| 33 | + ApiResponse( |
| 34 | + responseCode = "200", |
| 35 | + description = "로그인 성공", |
| 36 | + content = arrayOf(Content(schema = Schema(implementation = TokenResponse::class))), |
| 37 | + ), |
| 38 | + ApiResponse( |
| 39 | + responseCode = "401", |
| 40 | + description = "비밀번호가 일치하지 않음 - Invalid User Password", |
| 41 | + content = arrayOf(Content()), |
| 42 | + ), |
| 43 | + ApiResponse( |
| 44 | + responseCode = "404", |
| 45 | + description = "존재하지 않는 관리자 ID - Admin Not Found", |
| 46 | + content = arrayOf(Content()), |
| 47 | + ), |
| 48 | + ) |
| 49 | + fun login( |
| 50 | + @RequestBody @Valid adminLoginRequest: AdminLoginRequest, |
| 51 | + ): TokenResponse |
| 52 | + |
| 53 | + /** |
| 54 | + * 관리자 토큰을 갱신합니다. |
| 55 | + */ |
| 56 | + @Operation( |
| 57 | + summary = "관리자 토큰 갱신", |
| 58 | + description = "Refresh Token을 사용하여 새로운 Access Token을 발급받습니다.", |
| 59 | + ) |
| 60 | + @ApiResponses( |
| 61 | + ApiResponse( |
| 62 | + responseCode = "200", |
| 63 | + description = "토큰 갱신 성공", |
| 64 | + content = arrayOf(Content(schema = Schema(implementation = TokenResponse::class))), |
| 65 | + ), |
| 66 | + ApiResponse( |
| 67 | + responseCode = "401", |
| 68 | + description = "유효하지 않거나 만료된 토큰 - Invalid Token | Expired Token", |
| 69 | + content = arrayOf(Content()), |
| 70 | + ), |
| 71 | + ) |
| 72 | + fun tokenRefresh( |
| 73 | + @Parameter(description = "갱신할 Refresh Token", required = true) |
| 74 | + @RequestHeader("X-Refresh-Token") refreshToken: String, |
| 75 | + ): TokenResponse |
| 76 | + |
| 77 | + @Operation( |
| 78 | + summary = "모든 테이블 삭제 (Kafka 메시지 발송)", |
| 79 | + description = "Kafka를 통해 모든 테이블 삭제 메시지를 발송합니다. 실제 삭제는 Consumer에서 처리됩니다.", |
| 80 | + ) |
| 81 | + @ApiResponses( |
| 82 | + ApiResponse( |
| 83 | + responseCode = "204", |
| 84 | + description = "삭제 메시지 발송 완료", |
| 85 | + content = arrayOf(Content()), |
| 86 | + ), |
| 87 | + ApiResponse( |
| 88 | + responseCode = "401", |
| 89 | + description = "관리자 권한 없음 - Admin UnAuthorized", |
| 90 | + content = arrayOf(Content()), |
| 91 | + ), |
| 92 | + ) |
| 93 | + /** |
| 94 | + * 모든 테이블 삭제 메시지를 발송합니다. |
| 95 | + */ |
| 96 | + @SecurityRequirement(name = "bearerAuth") |
| 97 | + fun deleteAllTable() |
| 98 | + |
| 99 | + /** |
| 100 | + * UUID로 관리자 정보를 조회합니다. |
| 101 | + */ |
| 102 | + @Operation( |
| 103 | + summary = "관리자 정보 조회", |
| 104 | + description = "UUID로 특정 관리자의 정보를 조회합니다.", |
| 105 | + ) |
| 106 | + @ApiResponses( |
| 107 | + ApiResponse( |
| 108 | + responseCode = "200", |
| 109 | + description = "조회 성공", |
| 110 | + content = arrayOf(Content(schema = Schema(implementation = InternalAdminResponse::class))), |
| 111 | + ), |
| 112 | + ApiResponse( |
| 113 | + responseCode = "404", |
| 114 | + description = "존재하지 않는 관리자 - Admin Not Found", |
| 115 | + content = arrayOf(Content()), |
| 116 | + ), |
| 117 | + ) |
| 118 | + fun findAdminById( |
| 119 | + @Parameter(description = "조회할 관리자의 UUID", required = true) |
| 120 | + @PathVariable adminId: UUID, |
| 121 | + ): InternalAdminResponse |
| 122 | +} |
0 commit comments