Skip to content
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

feat:API定義を行いました #9

Merged
merged 2 commits into from
Mar 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
203 changes: 203 additions & 0 deletions typing-server/openapi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
openapi: 3.0.0
info:
title: Typing API
version: 1.0.0
servers:
- url: http://localhost:8080
description: ローカル開発環境
- url: https://typemaster.com
description: 本番環境
paths:
/users:
post:
summary: 新しいユーザーを作成
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
MailAdress:
type: string
maxLength: 255
HandleName:
type: string
maxLength: 36
Name:
type: string
maxLength: 36
HashedPassword:
type: string
maxLength: 255
Department:
type: string
enum: [CS, BI, IA]
responses:
'201':
description: ユーザー作成成功
'400':
description: 不正なリクエスト
/users/{userId}:
get:
summary: ユーザー情報を取得
parameters:
- in: path
name: userId
required: true
schema:
type: string
responses:
'200':
description: ユーザー情報取得成功
content:
application/json:
schema:
$ref: '#/components/schemas/User'
'404':
description: ユーザーが見つからない
/users/{userId}/scores:
post:
summary: ユーザーのスコアを登録
parameters:
- in: path
name: userId
required: true
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
keystrokes:
type: integer
accuracy:
type: number
format: float
score:
type: number
format: float
startedAt:
type: string
format: date-time
endedAt:
type: string
format: date-time
responses:
'201':
description: スコア登録成功
'400':
description: 不正なリクエスト
/users/{userId}/scores/{scoreId}:
get:
summary: 特定のスコア情報の取得
parameters:
- in: path
name: userId
required: true
schema:
type: string
- in: path
name: scoreId
required: true
schema:
type: string
responses:
'200':
description: スコア情報の取得成功
content:
application/json:
schema:
$ref: '#/components/schemas/Score'
'404':
description: スコアが見つからない

put:
summary: ユーザーのスコアを更新
parameters:
- in: path
name: userId
required: true
schema:
type: string
- in: path
name: scoreId
required: true
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
keystrokes:
type: integer
accuracy:
type: number
format: float
score:
type: number
format: float
startedAt:
type: string
format: date-time
endedAt:
type: string
format: date-time
responses:
'200':
description: スコアの更新成功
'400':
description: 不正なリクエスト
'404':
description: スコアが見つからない
components:
schemas:
User:
type: object
properties:
id:
type: string
format: uuid
MailAdress:
type: string
HandleName:
type: string
Name:
type: string
HashedPassword:
type: string
Department:
type: string
enum: [CS, BI, IA]
created_at:
type: string
format: date-time
updated_at:
type: string
format: date-time
Score:
type: object
properties:
id:
type: string
format: uuid
keystrokes:
type: integer
accuracy:
type: number
format: float
score:
type: number
format: float
startedAt:
type: string
format: date-time
endedAt:
type: string
format: date-time
Loading