diff --git a/typing-server/openapi.yaml b/typing-server/openapi.yaml new file mode 100644 index 0000000..94e9455 --- /dev/null +++ b/typing-server/openapi.yaml @@ -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