From 658d59aa553d17545957d902b78442bb44dbe2fb Mon Sep 17 00:00:00 2001 From: shin0729 Date: Wed, 6 Mar 2024 13:19:35 +0900 Subject: [PATCH] =?UTF-8?q?feat:API=E5=AE=9A=E7=BE=A9=E3=82=92=E8=A1=8C?= =?UTF-8?q?=E3=81=84=E3=81=BE=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- typing-server/openapi.yaml | 203 +++++++++++++++++++++++++++++++++++++ 1 file changed, 203 insertions(+) create mode 100644 typing-server/openapi.yaml 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