Skip to content

Commit

Permalink
Merge pull request #116 from kitcc-org/115-bulk-delete-api
Browse files Browse the repository at this point in the history
書籍とユーザをまとめて削除できるAPIを追加した
  • Loading branch information
kimurash authored Nov 4, 2024
2 parents 23d96b6 + 00a2f9a commit a254c90
Show file tree
Hide file tree
Showing 16 changed files with 771 additions and 45 deletions.
71 changes: 71 additions & 0 deletions api/bundle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ paths:
type: string
publishedDate:
type: string
format: date
description:
type: string
thumbnail:
Expand Down Expand Up @@ -177,6 +178,40 @@ paths:
$ref: '#/components/responses/Unauthorized'
'500':
$ref: '#/components/responses/InternalServerError'
delete:
tags:
- book
operationId: deleteBooks
summary: 指定された1冊以上の書籍を削除する
security:
- CookieAuth: []
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
bookIdList:
type: array
items:
type: integer
required:
- bookIdList
example:
bookIdList:
- 1
- 2
- 3
responses:
'204':
description: 書籍の削除に成功した
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'500':
$ref: '#/components/responses/InternalServerError'
/books/{bookId}:
get:
tags:
Expand Down Expand Up @@ -242,6 +277,7 @@ paths:
type: string
publishedDate:
type: string
format: date
isbn:
type: string
pattern: ^\d{10}(\d{3})?$
Expand Down Expand Up @@ -532,6 +568,40 @@ paths:
message: Conflict
'500':
$ref: '#/components/responses/InternalServerError'
delete:
tags:
- user
operationId: deleteUsers
summary: 指定された1人以上のユーザーを削除する
security:
- CookieAuth: []
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
userIdList:
type: array
items:
type: integer
required:
- userIdList
example:
userIdList:
- 1
- 2
- 3
responses:
'204':
description: ユーザーの削除に成功した
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'500':
$ref: '#/components/responses/InternalServerError'
/users/{userId}:
get:
tags:
Expand Down Expand Up @@ -910,6 +980,7 @@ components:
type: string
publishedDate:
type: string
format: date
description:
type: string
thumbnail:
Expand Down
1 change: 1 addition & 0 deletions api/components/schemas/Book.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ properties:
type: string
publishedDate:
type: string
format: date
description:
type: string
thumbnail:
Expand Down
36 changes: 36 additions & 0 deletions api/paths/book.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ books:
type: string
publishedDate:
type: string
format: date
description:
type: string
thumbnail:
Expand Down Expand Up @@ -159,6 +160,40 @@ books:
$ref: '../components/responses/4xx.yml#/Unauthorized'
'500':
$ref: '../components/responses/5xx.yml#/InternalServerError'
delete:
tags:
- book
operationId: deleteBooks
summary: 指定された1冊以上の書籍を削除する
security:
- CookieAuth: []
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
bookIdList:
type: array
items:
type: integer
required:
- bookIdList
example:
bookIdList:
- 1
- 2
- 3
responses:
'204':
description: 書籍の削除に成功した
'400':
$ref: '../components/responses/4xx.yml#/BadRequest'
'401':
$ref: '../components/responses/4xx.yml#/Unauthorized'
'500':
$ref: '../components/responses/5xx.yml#/InternalServerError'

book:
get:
Expand Down Expand Up @@ -227,6 +262,7 @@ book:
type: string
publishedDate:
type: string
format: date
isbn:
type: string
pattern: '^\d{10}(\d{3})?$'
Expand Down
101 changes: 68 additions & 33 deletions api/paths/user.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ users:
users:
type: array
items:
$ref: "../components/schemas/User.yml"
$ref: '../components/schemas/User.yml'
required:
- totalUser
- users
'400':
$ref: "../components/responses/4xx.yml#/BadRequest"
$ref: '../components/responses/4xx.yml#/BadRequest'
'500':
$ref: "../components/responses/5xx.yml#/InternalServerError"
$ref: '../components/responses/5xx.yml#/InternalServerError'

post:
tags:
Expand Down Expand Up @@ -90,33 +90,68 @@ users:
- email
- password
example:
name: "比企谷八幡"
email: "hikigaya@oregairu.com"
password: "passw0rd"
name: '比企谷八幡'
email: 'hikigaya@oregairu.com'
password: 'passw0rd'
responses:
'201':
description: ユーザーの追加に成功した
content:
application/json:
schema:
$ref: "../components/schemas/User.yml"
$ref: '../components/schemas/User.yml'
examples:
user:
$ref: "../components/examples/user.yml"
$ref: '../components/examples/user.yml'
'400':
$ref: "../components/responses/4xx.yml#/BadRequest"
$ref: '../components/responses/4xx.yml#/BadRequest'
'401':
$ref: "../components/responses/4xx.yml#/Unauthorized"
$ref: '../components/responses/4xx.yml#/Unauthorized'
'409':
description: すでに同じメールアドレスで登録されたユーザーが存在する
content:
application/json:
schema:
$ref: "../components/schemas/Error.yml"
$ref: '../components/schemas/Error.yml'
example:
message: "Conflict"
message: 'Conflict'
'500':
$ref: "../components/responses/5xx.yml#/InternalServerError"
$ref: '../components/responses/5xx.yml#/InternalServerError'

delete:
tags:
- user
operationId: deleteUsers
summary: 指定された1人以上のユーザーを削除する
security:
- CookieAuth: []
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
userIdList:
type: array
items:
type: integer
required:
- userIdList
example:
userIdList:
- 1
- 2
- 3
responses:
'204':
description: ユーザーの削除に成功した
'400':
$ref: '../components/responses/4xx.yml#/BadRequest'
'401':
$ref: '../components/responses/4xx.yml#/Unauthorized'
'500':
$ref: '../components/responses/5xx.yml#/InternalServerError'

user:
get:
Expand All @@ -128,7 +163,7 @@ user:
parameters:
- name: userId
in: path
description: "取得するユーザーのID"
description: '取得するユーザーのID'
required: true
schema:
type: string
Expand All @@ -139,16 +174,16 @@ user:
content:
application/json:
schema:
$ref: "../components/schemas/User.yml"
$ref: '../components/schemas/User.yml'
examples:
user:
$ref: "../components/examples/user.yml"
$ref: '../components/examples/user.yml'
'400':
$ref: "../components/responses/4xx.yml#/BadRequest"
$ref: '../components/responses/4xx.yml#/BadRequest'
'404':
$ref: "../components/responses/4xx.yml#/NotFound"
$ref: '../components/responses/4xx.yml#/NotFound'
'500':
$ref: "../components/responses/5xx.yml#/InternalServerError"
$ref: '../components/responses/5xx.yml#/InternalServerError'

patch:
tags:
Expand Down Expand Up @@ -184,27 +219,27 @@ user:
pattern: ^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]+$
minLength: 8
example:
name: "比企谷八幡"
email: "hikigaya@oregairu.com"
password: "passw0rd"
name: '比企谷八幡'
email: 'hikigaya@oregairu.com'
password: 'passw0rd'
responses:
'200':
description: 情報の更新に成功した
content:
application/json:
schema:
$ref: "../components/schemas/User.yml"
$ref: '../components/schemas/User.yml'
examples:
user:
$ref: "../components/examples/user.yml"
$ref: '../components/examples/user.yml'
'400':
$ref: "../components/responses/4xx.yml#/BadRequest"
$ref: '../components/responses/4xx.yml#/BadRequest'
'401':
$ref: "../components/responses/4xx.yml#/Unauthorized"
$ref: '../components/responses/4xx.yml#/Unauthorized'
'404':
$ref: "../components/responses/4xx.yml#/NotFound"
$ref: '../components/responses/4xx.yml#/NotFound'
'500':
$ref: "../components/responses/5xx.yml#/InternalServerError"
$ref: '../components/responses/5xx.yml#/InternalServerError'

delete:
tags:
Expand Down Expand Up @@ -232,16 +267,16 @@ user:
message:
type: string
example:
message: "No Content"
message: 'No Content'
'400':
$ref: "../components/responses/4xx.yml#/BadRequest"
$ref: '../components/responses/4xx.yml#/BadRequest'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: "../components/schemas/Error.yml"
$ref: '../components/schemas/Error.yml'
'404':
$ref: "../components/responses/4xx.yml#/NotFound"
$ref: '../components/responses/4xx.yml#/NotFound'
'500':
$ref: "../components/responses/5xx.yml#/InternalServerError"
$ref: '../components/responses/5xx.yml#/InternalServerError'
Loading

0 comments on commit a254c90

Please sign in to comment.