641 lines
19 KiB
YAML
641 lines
19 KiB
YAML
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: Внутренний сервер
|
||
- name: TariffExternal
|
||
description: Внешний сервер
|
||
- name: TariffInternal
|
||
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"
|
||
/tariff/{id}:
|
||
get:
|
||
summary: получить тарифф по id
|
||
tags:
|
||
- TariffExternal
|
||
- TariffInternal
|
||
responses:
|
||
'200':
|
||
description: Тарифф успешно получен
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: "#/components/schemas/Tariff"
|
||
'400':
|
||
$ref: "#/components/responses/400"
|
||
'404':
|
||
$ref: "#/components/responses/404"
|
||
'500':
|
||
$ref: "#/components/responses/500"
|
||
put:
|
||
summary: обновить тарифф по id
|
||
tags:
|
||
- TariffInternal
|
||
parameters:
|
||
- name: id
|
||
in: path
|
||
required: true
|
||
schema:
|
||
type: string
|
||
description: id тарифа для обновления
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/Tariff'
|
||
responses:
|
||
'200':
|
||
description: Тариф успешно обновлен
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/Tariff'
|
||
'400':
|
||
$ref: "#/components/responses/400"
|
||
'404':
|
||
$ref: "#/components/responses/404"
|
||
'500':
|
||
$ref: "#/components/responses/500"
|
||
/tariff/getList:
|
||
get:
|
||
summary: получить тариффы с пагинацией
|
||
tags:
|
||
- TariffExternal
|
||
- TariffInternal
|
||
parameters:
|
||
- name: page
|
||
in: query
|
||
description: Номер страницы для пагинации
|
||
required: false
|
||
schema:
|
||
type: integer
|
||
default: 1
|
||
- name: limit
|
||
in: query
|
||
description: Количество элементов на странице
|
||
required: false
|
||
schema:
|
||
type: integer
|
||
default: 25
|
||
responses:
|
||
'200':
|
||
description: Успешный ответ с тариффами
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/TariffPagination'
|
||
'401':
|
||
$ref: "#/components/responses/401"
|
||
'500':
|
||
$ref: "#/components/responses/500"
|
||
|
||
/tariff/:
|
||
post:
|
||
summary: создать тарифф
|
||
tags:
|
||
- TariffExternal
|
||
- TariffInternal
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/Tariff'
|
||
responses:
|
||
'200':
|
||
description: Тариф успешно создан
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/Tariff'
|
||
'400':
|
||
$ref: "#/components/responses/400"
|
||
'401':
|
||
$ref: "#/components/responses/401"
|
||
'500':
|
||
$ref: "#/components/responses/500"
|
||
delete:
|
||
summary: метод мягкого удаления тариффа
|
||
tags:
|
||
- TariffInternal
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
id:
|
||
type: string
|
||
description: id тарифа для удаления
|
||
required:
|
||
- id
|
||
responses:
|
||
'200':
|
||
description: Тариф успешно удален
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/Tariff'
|
||
'400':
|
||
$ref: "#/components/responses/400"
|
||
'404':
|
||
$ref: "#/components/responses/404"
|
||
'500':
|
||
$ref: "#/components/responses/500"
|
||
/tariff/restore:
|
||
post:
|
||
summary: метод восстановления тариффа из мягко удаленных
|
||
tags:
|
||
- TariffInternal
|
||
requestBody:
|
||
required: true
|
||
content:
|
||
application/json:
|
||
schema:
|
||
type: object
|
||
properties:
|
||
id:
|
||
type: string
|
||
description: id тарифа для восстановления
|
||
required:
|
||
- id
|
||
responses:
|
||
'200':
|
||
description: Тариф успешно восстановлен
|
||
content:
|
||
application/json:
|
||
schema:
|
||
$ref: '#/components/schemas/Tariff'
|
||
'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"
|
||
Tariff:
|
||
type: object
|
||
properties:
|
||
_id:
|
||
type: string
|
||
format: objectId
|
||
description: id тарифа objectID в mongo
|
||
name:
|
||
type: string
|
||
description: Название тариффа
|
||
userID:
|
||
type: string
|
||
description: id пользователя котторому принадлежит тариф, либо пустое если тарифф создаваля админом
|
||
description:
|
||
type: string
|
||
description: Описание тариффа
|
||
price:
|
||
type: integer
|
||
description: цена тарифа
|
||
order:
|
||
type: integer
|
||
description:
|
||
isCustom:
|
||
type: boolean
|
||
description: Флаг состояни кастомного тариффа
|
||
privileges:
|
||
type: array
|
||
items:
|
||
$ref: '#/components/schemas/Privilege'
|
||
description: Привилегии входящие в тарифф
|
||
isDeleted:
|
||
type: boolean
|
||
description: Флаг состояния удаления
|
||
createdAt:
|
||
type: string
|
||
format: date-time
|
||
description: Время создания
|
||
updatedAt:
|
||
type: string
|
||
format: date-time
|
||
description: Последнее время удаления
|
||
deletedAt:
|
||
type: string
|
||
format: date-time
|
||
description: Время удаления
|
||
TariffPagination:
|
||
type: object
|
||
properties:
|
||
totalPages:
|
||
type: integer
|
||
description: количество страниц на количесво элементов
|
||
tariffs:
|
||
type: array
|
||
items:
|
||
$ref: '#/components/schemas/Tariff'
|
||
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 |