-
Notifications
You must be signed in to change notification settings - Fork 0
feat: swagger 문서화 #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
632f08c
feat: swagger 문서화
AndyH0ng 5d8e56e
chore: bun lockfile
AndyH0ng fbf3b26
chore: swagger-ui-dist 제거
AndyH0ng 30eb552
refactor: 날짜 필드에 format 어노테이션
AndyH0ng 4b5f891
refactor: 404 스키마 통일
AndyH0ng 2206530
docs: Response 문서화
AndyH0ng c38ae7f
fix: 백엔드 도메인 CORS 허용
AndyH0ng bfa9202
chore: 상대 경로로 수정
AndyH0ng File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,283 @@ | ||
| export const openApiSpec = { | ||
| openapi: '3.0.3', | ||
| info: { | ||
| title: 'BOJ Jury API', | ||
| version: '1.0.0', | ||
| description: 'BOJ 풀이 기반 리그 대회 관리 API', | ||
| }, | ||
| servers: [{ url: 'https://boj-jury.gameworks.workers.dev' }], | ||
AndyH0ng marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
AndyH0ng marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| components: { | ||
| securitySchemes: { | ||
| bearerAuth: { | ||
| type: 'http', | ||
| scheme: 'bearer', | ||
| description: 'ADMIN_TOKEN (wrangler secret)', | ||
| }, | ||
| }, | ||
| schemas: { | ||
| League: { type: 'string', enum: ['ROOKIE', 'JUNIOR', 'PRO'] }, | ||
| Error: { | ||
| type: 'object', | ||
| properties: { error: { type: 'string' } }, | ||
| }, | ||
| }, | ||
| }, | ||
| paths: { | ||
| // ── 참가자 등록 ──────────────────────────────────────────────────────── | ||
| '/register': { | ||
| post: { | ||
| tags: ['Registration'], | ||
| summary: '참가자 등록', | ||
| requestBody: { | ||
| required: true, | ||
| content: { | ||
| 'application/json': { | ||
| schema: { | ||
| type: 'object', | ||
| required: ['real_name', 'boj_handle'], | ||
| properties: { | ||
| real_name: { type: 'string', example: '홍길동' }, | ||
| boj_handle: { type: 'string', example: 'gildong' }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| responses: { | ||
| 201: { | ||
| description: '등록 성공', | ||
| content: { | ||
| 'application/json': { | ||
| schema: { | ||
| type: 'object', | ||
| properties: { | ||
| real_name: { type: 'string' }, | ||
| boj_handle: { type: 'string' }, | ||
| league: { $ref: '#/components/schemas/League' }, | ||
| registered_at: { type: 'string', format: 'date-time' }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| 400: { description: '잘못된 요청 (핸들 없음, 조직 미인증 등)', content: { 'application/json': { schema: { $ref: '#/components/schemas/Error' } } } }, | ||
| }, | ||
| }, | ||
| }, | ||
| '/register/status': { | ||
| get: { | ||
| tags: ['Registration'], | ||
| summary: '등록 현황 조회', | ||
| parameters: [ | ||
| { name: 'boj_handle', in: 'query', required: true, schema: { type: 'string' } }, | ||
| ], | ||
| responses: { | ||
| 200: { | ||
| description: '조회 성공', | ||
| content: { | ||
| 'application/json': { | ||
| schema: { | ||
| type: 'object', | ||
| properties: { | ||
| contest_name: { type: 'string' }, | ||
| real_name: { type: 'string' }, | ||
| boj_handle: { type: 'string' }, | ||
| league: { $ref: '#/components/schemas/League' }, | ||
| registered_at: { type: 'string' }, | ||
| is_disqualified: { type: 'boolean' }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| 404: { description: '참가자 없음' }, | ||
AndyH0ng marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| }, | ||
| }, | ||
| }, | ||
|
|
||
| // ── 리더보드 ────────────────────────────────────────────────────────── | ||
| '/leaderboard': { | ||
| get: { | ||
| tags: ['Leaderboard'], | ||
| summary: '리더보드 조회', | ||
| parameters: [ | ||
| { name: 'league', in: 'query', required: false, schema: { $ref: '#/components/schemas/League' } }, | ||
| ], | ||
| responses: { | ||
| 200: { | ||
| description: '조회 성공', | ||
| content: { | ||
| 'application/json': { | ||
| schema: { | ||
| type: 'object', | ||
| properties: { | ||
| results: { | ||
| type: 'array', | ||
| items: { | ||
| type: 'object', | ||
| properties: { | ||
| contest_name: { type: 'string' }, | ||
| league: { $ref: '#/components/schemas/League' }, | ||
| generated_at: { type: 'string' }, | ||
| rows: { | ||
| type: 'array', | ||
| items: { | ||
| type: 'object', | ||
| properties: { | ||
| rank: { type: 'integer' }, | ||
| boj_handle: { type: 'string' }, | ||
| real_name: { type: 'string' }, | ||
| total_score: { type: 'integer' }, | ||
| solved_count: { type: 'integer' }, | ||
| last_solved_at: { type: 'string', nullable: true }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
|
|
||
| // ── 관리자 — 대회 ───────────────────────────────────────────────────── | ||
| '/admin/contests': { | ||
| post: { | ||
| tags: ['Admin / Contest'], | ||
| summary: '대회 생성', | ||
| security: [{ bearerAuth: [] }], | ||
| requestBody: { | ||
| required: true, | ||
| content: { | ||
| 'application/json': { | ||
| schema: { | ||
| type: 'object', | ||
| required: ['name', 'start_at', 'end_at'], | ||
| properties: { | ||
| name: { type: 'string', example: '2025 Spring League' }, | ||
| start_at: { type: 'string', example: '2025-03-01' }, | ||
| end_at: { type: 'string', example: '2025-05-31' }, | ||
AndyH0ng marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| leaderboard_post_time: { type: 'string', example: '21:00', default: '21:00' }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| responses: { | ||
| 201: { description: '생성 성공' }, | ||
| 401: { description: '인증 실패' }, | ||
AndyH0ng marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| }, | ||
| }, | ||
| }, | ||
| '/admin/contests/name': { | ||
| patch: { | ||
| tags: ['Admin / Contest'], | ||
| summary: '대회 이름 변경', | ||
| security: [{ bearerAuth: [] }], | ||
| requestBody: { | ||
| required: true, | ||
| content: { 'application/json': { schema: { type: 'object', required: ['new_name'], properties: { new_name: { type: 'string' } } } } }, | ||
| }, | ||
| responses: { 200: { description: '변경 성공' }, 401: { description: '인증 실패' } }, | ||
| }, | ||
| }, | ||
| '/admin/contests/period': { | ||
| patch: { | ||
| tags: ['Admin / Contest'], | ||
| summary: '대회 기간 변경', | ||
| security: [{ bearerAuth: [] }], | ||
| requestBody: { | ||
| required: true, | ||
| content: { 'application/json': { schema: { type: 'object', required: ['start_at', 'end_at'], properties: { start_at: { type: 'string' }, end_at: { type: 'string' } } } } }, | ||
| }, | ||
| responses: { 200: { description: '변경 성공' }, 401: { description: '인증 실패' } }, | ||
| }, | ||
| }, | ||
| '/admin/contests/leaderboard-time': { | ||
| patch: { | ||
| tags: ['Admin / Contest'], | ||
| summary: '리더보드 게시 시각 변경', | ||
| security: [{ bearerAuth: [] }], | ||
| requestBody: { | ||
| required: true, | ||
| content: { 'application/json': { schema: { type: 'object', required: ['time'], properties: { time: { type: 'string', example: '21:00' } } } } }, | ||
| }, | ||
| responses: { 200: { description: '변경 성공' }, 401: { description: '인증 실패' } }, | ||
| }, | ||
| }, | ||
| '/admin/contests/pause': { post: { tags: ['Admin / Contest'], summary: '대회 일시정지', security: [{ bearerAuth: [] }], responses: { 200: { description: '성공' } } } }, | ||
| '/admin/contests/resume': { post: { tags: ['Admin / Contest'], summary: '대회 재개', security: [{ bearerAuth: [] }], responses: { 200: { description: '성공' } } } }, | ||
| '/admin/contests/archive': { post: { tags: ['Admin / Contest'], summary: '대회 보관', security: [{ bearerAuth: [] }], responses: { 200: { description: '성공' } } } }, | ||
|
|
||
| '/admin/leaderboard/refresh': { | ||
| post: { | ||
| tags: ['Admin / Leaderboard'], | ||
| summary: '스냅샷 수동 갱신', | ||
| security: [{ bearerAuth: [] }], | ||
| responses: { 200: { description: '갱신 성공' }, 401: { description: '인증 실패' } }, | ||
| }, | ||
| }, | ||
|
|
||
| // ── 관리자 — 참가자 ─────────────────────────────────────────────────── | ||
| '/admin/users': { | ||
| get: { | ||
| tags: ['Admin / Users'], | ||
| summary: '참가자 목록 조회', | ||
| security: [{ bearerAuth: [] }], | ||
| parameters: [ | ||
| { name: 'league', in: 'query', required: false, schema: { $ref: '#/components/schemas/League' } }, | ||
| ], | ||
| responses: { 200: { description: '조회 성공' }, 401: { description: '인증 실패' } }, | ||
AndyH0ng marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| }, | ||
| }, | ||
| '/admin/users/{handle}': { | ||
| get: { | ||
| tags: ['Admin / Users'], | ||
| summary: '참가자 상세 조회', | ||
| security: [{ bearerAuth: [] }], | ||
| parameters: [{ name: 'handle', in: 'path', required: true, schema: { type: 'string' } }], | ||
| responses: { 200: { description: '조회 성공' }, 404: { description: '참가자 없음' } }, | ||
| }, | ||
| }, | ||
| '/admin/users/{handle}/disqualify': { | ||
| post: { | ||
| tags: ['Admin / Users'], | ||
| summary: '참가자 실격 처리', | ||
| security: [{ bearerAuth: [] }], | ||
| parameters: [{ name: 'handle', in: 'path', required: true, schema: { type: 'string' } }], | ||
| responses: { 200: { description: '성공' }, 404: { description: '참가자 없음' } }, | ||
| }, | ||
| }, | ||
| '/admin/users/{handle}/name': { | ||
| patch: { | ||
| tags: ['Admin / Users'], | ||
| summary: '참가자 실명 수정', | ||
| security: [{ bearerAuth: [] }], | ||
| parameters: [{ name: 'handle', in: 'path', required: true, schema: { type: 'string' } }], | ||
| requestBody: { | ||
| required: true, | ||
| content: { 'application/json': { schema: { type: 'object', required: ['new_name'], properties: { new_name: { type: 'string' } } } } }, | ||
| }, | ||
| responses: { 200: { description: '수정 성공' } }, | ||
AndyH0ng marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| }, | ||
| }, | ||
| '/admin/users/{handle}/league': { | ||
| patch: { | ||
| tags: ['Admin / Users'], | ||
| summary: '참가자 리그 수정', | ||
| security: [{ bearerAuth: [] }], | ||
| parameters: [{ name: 'handle', in: 'path', required: true, schema: { type: 'string' } }], | ||
| requestBody: { | ||
| required: true, | ||
| content: { 'application/json': { schema: { type: 'object', required: ['league'], properties: { league: { $ref: '#/components/schemas/League' } } } } }, | ||
| }, | ||
| responses: { 200: { description: '수정 성공' } }, | ||
| }, | ||
| }, | ||
| }, | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.