From 62b04c9c335dbd8b65abb98ececda3d9d0884fd0 Mon Sep 17 00:00:00 2001 From: KinjiKawaguchi Date: Sun, 24 Mar 2024 23:34:16 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=E3=83=A6=E3=83=BC=E3=82=B6=E3=83=BC?= =?UTF-8?q?=E6=83=85=E5=A0=B1=E5=8F=96=E5=BE=97API=E3=81=AE=E3=83=91?= =?UTF-8?q?=E3=83=A9=E3=83=A1=E3=83=BC=E3=82=BF=E3=82=92=E5=A4=89=E6=9B=B4?= =?UTF-8?q?=E3=81=97=E3=80=81=E3=82=B9=E3=82=B3=E3=82=A2=E3=83=A9=E3=83=B3?= =?UTF-8?q?=E3=82=AD=E3=83=B3=E3=82=B0API=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- typing-server/openapi.yaml | 196 +++++++++++-------------------------- 1 file changed, 56 insertions(+), 140 deletions(-) diff --git a/typing-server/openapi.yaml b/typing-server/openapi.yaml index 94e9455..0cf174c 100644 --- a/typing-server/openapi.yaml +++ b/typing-server/openapi.yaml @@ -9,153 +9,80 @@ servers: 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 + - in: query + name: student_number schema: type: string + description: 学生番号 + required: true responses: - '200': + "200": description: ユーザー情報取得成功 content: application/json: schema: - $ref: '#/components/schemas/User' - '404': + $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}: + + /scores/ranking: get: - summary: 特定のスコア情報の取得 + summary: スコアランキングを取得 parameters: - - in: path - name: userId - required: true + - in: query + name: sort_by schema: type: string - - in: path - name: scoreId - required: true + enum: [keystrokes, accuracy] + description: ソート対象のカラム + - in: query + name: start schema: - type: string + type: integer + description: ランキングの開始位置 responses: - '200': - description: スコア情報の取得成功 + "200": + description: スコアランキング取得成功 content: application/json: schema: - $ref: '#/components/schemas/Score' - '404': - description: スコアが見つからない + type: array + items: + $ref: "#/components/schemas/ScoreRanking" - put: - summary: ユーザーのスコアを更新 + /scores: + post: + summary: スコアを登録 parameters: - - in: path - name: userId - required: true + - in: query + name: user_id schema: type: string - - in: path - name: scoreId + format: uuid required: true + description: ユーザーID + - in: query + name: keystrokes 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 + type: integer + required: true + description: キーストローク数 + - in: query + name: accuracy + schema: + type: number + format: float + required: true + description: 正確性 responses: - '200': - description: スコアの更新成功 - '400': + "201": + description: スコア登録成功 + "400": description: 不正なリクエスト - '404': - description: スコアが見つからない + components: schemas: User: @@ -164,40 +91,29 @@ components: id: type: string format: uuid - MailAdress: + student_number: type: string - HandleName: + handle_name: 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: + + ScoreRanking: type: object properties: - id: - type: string - format: uuid - keystrokes: + rank: type: integer - accuracy: - type: number - format: float + user: + $ref: "#/components/schemas/User" score: + type: integer + accuracy: type: number format: float - startedAt: - type: string - format: date-time - endedAt: + created_at: type: string format: date-time