add openapi
This commit is contained in:
parent
b589f416e8
commit
9b416ec3f3
416
docs/openapi.yaml
Normal file
416
docs/openapi.yaml
Normal file
@ -0,0 +1,416 @@
|
|||||||
|
openapi: 3.0.0
|
||||||
|
info:
|
||||||
|
title: hub_admin_backend_service
|
||||||
|
description: hub_admin_backend_service
|
||||||
|
version: 1.0.0
|
||||||
|
tags:
|
||||||
|
- name : PrivilegeExternal
|
||||||
|
description: Внешний сервер
|
||||||
|
- name : PrivilegeInternal
|
||||||
|
description: Внутренний сервер
|
||||||
|
paths:
|
||||||
|
/privilege/service:
|
||||||
|
get:
|
||||||
|
summary: Получить все привилегии поделенные по сервисам в ассоциативном массиве
|
||||||
|
tags:
|
||||||
|
- PrivilegeExternal
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: Успех. Получен ассоциативный массив, ключ - serviceKey, значение - массив привилегий этого сервиса.
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/ServicePrivilegesMap"
|
||||||
|
'404':
|
||||||
|
$ref: "#/components/responses/404"
|
||||||
|
'500':
|
||||||
|
$ref: "#/components/responses/500"
|
||||||
|
|
||||||
|
/privilege:
|
||||||
|
get:
|
||||||
|
summary: Получить все привилегии
|
||||||
|
tags:
|
||||||
|
- PrivilegeInternal
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: Успех. Возвращается список привилегий.
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: "#/components/schemas/Privilege"
|
||||||
|
'404':
|
||||||
|
$ref: "#/components/responses/404"
|
||||||
|
'500':
|
||||||
|
$ref: "#/components/responses/500"
|
||||||
|
|
||||||
|
post:
|
||||||
|
summary: Создать новую привилегию
|
||||||
|
tags:
|
||||||
|
- PrivilegeInternal
|
||||||
|
requestBody:
|
||||||
|
description: Данные для создания привилегии
|
||||||
|
required: true
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/CreateUpdateReq"
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: Привилегия успешно создана
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/Privilege"
|
||||||
|
'400':
|
||||||
|
$ref: "#/components/responses/400"
|
||||||
|
'409':
|
||||||
|
$ref: "#/components/responses/409"
|
||||||
|
'500':
|
||||||
|
$ref: "#/components/responses/500"
|
||||||
|
|
||||||
|
put:
|
||||||
|
summary: Обновить существующую привилегию
|
||||||
|
tags:
|
||||||
|
- PrivilegeInternal
|
||||||
|
requestBody:
|
||||||
|
description: Данные для обновления привилегии
|
||||||
|
required: true
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/CreateUpdateReq"
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: Привилегия успешно обновлена
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/Privilege"
|
||||||
|
'400':
|
||||||
|
$ref: "#/components/responses/400"
|
||||||
|
'404':
|
||||||
|
$ref: "#/components/responses/404"
|
||||||
|
'500':
|
||||||
|
$ref: "#/components/responses/500"
|
||||||
|
|
||||||
|
delete:
|
||||||
|
summary: Удалить привилегию
|
||||||
|
tags:
|
||||||
|
- PrivilegeInternal
|
||||||
|
requestBody:
|
||||||
|
description: Данные для удвления привилегии
|
||||||
|
required: true
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/DeleteRestoreReq"
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: Привилегия успешно удалена
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/Privilege"
|
||||||
|
'400':
|
||||||
|
$ref: "#/components/responses/400"
|
||||||
|
'404':
|
||||||
|
$ref: "#/components/responses/404"
|
||||||
|
'500':
|
||||||
|
$ref: "#/components/responses/500"
|
||||||
|
|
||||||
|
/privilege/{privilegeId}:
|
||||||
|
get:
|
||||||
|
summary: Получить привилегию по ID
|
||||||
|
tags:
|
||||||
|
- PrivilegeInternal
|
||||||
|
parameters:
|
||||||
|
- name: privilegeId
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
description: Идентификатор привилегии
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: Привилегия успешно получена
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/Privilege"
|
||||||
|
'400':
|
||||||
|
$ref: "#/components/responses/400"
|
||||||
|
'404':
|
||||||
|
$ref: "#/components/responses/404"
|
||||||
|
'500':
|
||||||
|
$ref: "#/components/responses/500"
|
||||||
|
|
||||||
|
/privilege/service/{serviceKey}:
|
||||||
|
get:
|
||||||
|
summary: Получить привилегии по ключу сервиса
|
||||||
|
tags:
|
||||||
|
- PrivilegeInternal
|
||||||
|
parameters:
|
||||||
|
- name: serviceKey
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
description: Ключ сервиса
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: Успешный ответ
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: "#/components/schemas/Privilege"
|
||||||
|
'400':
|
||||||
|
$ref: "#/components/responses/400"
|
||||||
|
'404':
|
||||||
|
$ref: "#/components/responses/404"
|
||||||
|
'500':
|
||||||
|
$ref: "#/components/responses/500"
|
||||||
|
|
||||||
|
/privilege/many:
|
||||||
|
post:
|
||||||
|
summary: Создать несколько привилегий
|
||||||
|
tags:
|
||||||
|
- PrivilegeInternal
|
||||||
|
requestBody:
|
||||||
|
description: Данные для создания привилегий
|
||||||
|
required: true
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/PostPutMany"
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: Успешный ответ
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: "#/components/schemas/Privilege"
|
||||||
|
'400':
|
||||||
|
$ref: "#/components/responses/400"
|
||||||
|
'409':
|
||||||
|
$ref: "#/components/responses/409"
|
||||||
|
'500':
|
||||||
|
$ref: "#/components/responses/500"
|
||||||
|
|
||||||
|
put:
|
||||||
|
summary: Обновить несколько привилегий
|
||||||
|
tags:
|
||||||
|
- PrivilegeInternal
|
||||||
|
requestBody:
|
||||||
|
description: Данные для обновления привилегий
|
||||||
|
required: true
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/PostPutMany"
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: Успешный ответ
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: "#/components/schemas/Privilege"
|
||||||
|
'400':
|
||||||
|
$ref: "#/components/responses/400"
|
||||||
|
'404':
|
||||||
|
$ref: "#/components/responses/404"
|
||||||
|
'500':
|
||||||
|
$ref: "#/components/responses/500"
|
||||||
|
|
||||||
|
/privilege/restore:
|
||||||
|
post:
|
||||||
|
summary: Восстановить удалённые привилегии
|
||||||
|
tags:
|
||||||
|
- PrivilegeInternal
|
||||||
|
requestBody:
|
||||||
|
description: Данные для восстановления привилегии
|
||||||
|
required: true
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/DeleteRestoreReq"
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: Привилегия успешно восстановлена
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/Privilege"
|
||||||
|
'400':
|
||||||
|
$ref: "#/components/responses/400"
|
||||||
|
'404':
|
||||||
|
$ref: "#/components/responses/404"
|
||||||
|
'500':
|
||||||
|
$ref: "#/components/responses/500"
|
||||||
|
|
||||||
|
components:
|
||||||
|
schemas:
|
||||||
|
Privilege:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: string
|
||||||
|
description: Уникальный идентификатор привилегии
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
description: Имя привилегии
|
||||||
|
privilegeId:
|
||||||
|
type: string
|
||||||
|
description: Идентификатор привилегии
|
||||||
|
serviceKey:
|
||||||
|
type: string
|
||||||
|
description: Ключ сервиса, к которому относится привилегия
|
||||||
|
description:
|
||||||
|
type: string
|
||||||
|
description: Описание привилегии
|
||||||
|
type:
|
||||||
|
type: string
|
||||||
|
description: Тип привилегии
|
||||||
|
value:
|
||||||
|
type: string
|
||||||
|
description: Значение привилегии
|
||||||
|
price:
|
||||||
|
type: number
|
||||||
|
format: float
|
||||||
|
description: Цена привилегии
|
||||||
|
createdAt:
|
||||||
|
type: string
|
||||||
|
format: date-time
|
||||||
|
description: Дата создания привилегии
|
||||||
|
updatedAt:
|
||||||
|
type: string
|
||||||
|
format: date-time
|
||||||
|
description: Дата последнего обновления привилегии
|
||||||
|
isDeleted:
|
||||||
|
type: boolean
|
||||||
|
description: Флаг удаления привилегии
|
||||||
|
deletedAt:
|
||||||
|
type: string
|
||||||
|
format: date-time
|
||||||
|
description: Дата удаления привилегии (если была удалена)
|
||||||
|
nullable: true
|
||||||
|
ServicePrivilegesMap:
|
||||||
|
type: object
|
||||||
|
description: Ассоциативный массив, где ключ - serviceKey, значение - массив привилегий этого сервиса.
|
||||||
|
additionalProperties:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: "#/components/schemas/Privilege"
|
||||||
|
CreateUpdateReq:
|
||||||
|
type: object
|
||||||
|
description: Данные для создания или обновления привилегии
|
||||||
|
properties:
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
description: Имя привилегии
|
||||||
|
privilegeId:
|
||||||
|
type: string
|
||||||
|
description: Уникальный идентификатор привилегии
|
||||||
|
serviceKey:
|
||||||
|
type: string
|
||||||
|
description: Ключ сервиса, к которому относится привилегия
|
||||||
|
description:
|
||||||
|
type: string
|
||||||
|
description: Описание привилегии
|
||||||
|
type:
|
||||||
|
type: string
|
||||||
|
description: Тип привилегии
|
||||||
|
value:
|
||||||
|
type: string
|
||||||
|
description: Значение привилегии
|
||||||
|
price:
|
||||||
|
type: number
|
||||||
|
format: float
|
||||||
|
description: Цена привилегии
|
||||||
|
DeleteRestoreReq:
|
||||||
|
type: object
|
||||||
|
description: Данные для удаления, восстановления привилегии
|
||||||
|
properties:
|
||||||
|
privilegeId:
|
||||||
|
type: string
|
||||||
|
description: Идентификатор привилегии, которую нужно удалить
|
||||||
|
PostPutMany:
|
||||||
|
type: object
|
||||||
|
description: Данные для создания, обновления массива привилегий
|
||||||
|
properties:
|
||||||
|
privileges:
|
||||||
|
type: array
|
||||||
|
description: Массив объектов для создания или обновления привилегий
|
||||||
|
items:
|
||||||
|
$ref: "#/components/schemas/CreateUpdateReq"
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: Success
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
description: Success
|
||||||
|
'201':
|
||||||
|
description: Created
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
description: Created
|
||||||
|
'204':
|
||||||
|
description: No content
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
description: No content
|
||||||
|
'400':
|
||||||
|
description: Bad Request
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
description: Bad Request
|
||||||
|
'401':
|
||||||
|
description: Unauthorized
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
description: Unauthorized
|
||||||
|
'403':
|
||||||
|
description: Forbidden
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
description: Forbidden
|
||||||
|
'404':
|
||||||
|
description: Not Found
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
description: Not Found
|
||||||
|
'409':
|
||||||
|
description: Conflict
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
description: Already exist
|
||||||
|
'500':
|
||||||
|
description: Internal Server Error
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
description: Internal Server Error
|
Loading…
Reference in New Issue
Block a user