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

ユーザー操作に関するAPIを定義 #120

Merged
merged 3 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
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
8 changes: 8 additions & 0 deletions schema/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ security:
tags:
- name: forms
description: フォーム操作に関連するAPI
- name: users
description: ユーザー操作に関連するAPI

paths:
/forms:
Expand All @@ -43,3 +45,9 @@ paths:
$ref: "./paths/forms/answers/comment/index.yml"
/forms/labels:
$ref: "./paths/forms/labels/index.yml"
/users:
$ref: "./paths/users/index.yml"
/users/{uuid}:
$ref: "./paths/users/[uuid]/index.yml"
/users/list:
$ref: "./paths/users/list/index.yml"
21 changes: 21 additions & 0 deletions schema/paths/users/[uuid]/index.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
patch:
tags:
- users
operationId: updateUser
summary: ユーザー情報を変更する
parameters:
- $ref: "../../../types/users/parameters.yml#/parameters/uuid"
- $ref: "../../../types/users/parameters.yml#/parameters/role"
responses:
"200":
description: ユーザー情報の変更に成功
"400":
$ref: "../../../errors/errorResponses.yml#/components/responses/syntaxError"
"401":
$ref: "../../../errors/errorResponses.yml#/components/responses/unauthorized"
"403":
$ref: "../../../errors/errorResponses.yml#/components/responses/forbidden"
"404":
$ref: "../../../errors/errorResponses.yml#/components/responses/notFound"
"500":
$ref: "../../../errors/errorResponses.yml#/components/responses/internalServerError"
19 changes: 19 additions & 0 deletions schema/paths/users/index.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
get:
tags:
- users
operationId: getUserInfo
summary: 自身のユーザー情報の取得
description: |
Bearer TokenにMicrosoftから取得したトークンを含めて実行すると
自身のユーザー情報が帰ってきます
responses:
"200":
description: 自身のユーザー情報の取得成功
content:
application/json:
schema:
$ref: "../../types/users/definitions.yml#/definitions/user"
"401":
$ref: "../../errors/errorResponses.yml#/components/responses/unauthorized"
"500":
$ref: "../../errors/errorResponses.yml#/components/responses/internalServerError"
23 changes: 23 additions & 0 deletions schema/paths/users/list/index.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
get:
tags:
- users
operationId: getUsersList
summary: すべてのユーザーの取得
description: ユーザーリストを返します
responses:
"200":
description: 自身のユーザー情報の取得成功
content:
application/json:
schema:
$ref: "../../../types/users/definitions.yml#/definitions/users"
"400":
$ref: "../../../errors/errorResponses.yml#/components/responses/syntaxError"
"401":
$ref: "../../../errors/errorResponses.yml#/components/responses/unauthorized"
"403":
$ref: "../../../errors/errorResponses.yml#/components/responses/forbidden"
"404":
$ref: "../../../errors/errorResponses.yml#/components/responses/notFound"
"500":
$ref: "../../../errors/errorResponses.yml#/components/responses/internalServerError"
9 changes: 9 additions & 0 deletions schema/types/users/components.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,12 @@ components:
description: Minecraftプレイヤーに紐づくUUID
type: string
format: uuid
name:
description: Minecraftプレイヤー名
type: string
role:
description: ユーザー権限
type: string
enum:
- ADMINISTRATOR
- STANDARD_USER
18 changes: 18 additions & 0 deletions schema/types/users/definitions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
definitions:
user:
description: ユーザー
type: object
properties:
uuid:
$ref: "./components.yml#/components/schemas/uuid"
name:
$ref: "./components.yml#/components/schemas/name"
role:
$ref: "./components.yml#/components/schemas/role"
users:
description: ユーザーの配列
type: array
uniqueItems: true
minItems: 0
items:
$ref: "#/definitions/user"
15 changes: 15 additions & 0 deletions schema/types/users/parameters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
parameters:
uuid:
name: uuid
in: path
description: プレイヤーUUID
required: true
schema:
$ref: "./components.yml#/components/schemas/uuid"
role:
name: role
in: query
description: ユーザー権限
required: false
schema:
$ref: "./components.yml#/components/schemas/role"