From ff68956fb5ce78a574bbb0258dec1ea72061072d Mon Sep 17 00:00:00 2001 From: Pavel Date: Fri, 26 Jul 2024 16:57:56 +0300 Subject: [PATCH] added tariff rest to openapi docs --- docs/openapi.yaml | 225 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 225 insertions(+) diff --git a/docs/openapi.yaml b/docs/openapi.yaml index 5040b88..04039f6 100644 --- a/docs/openapi.yaml +++ b/docs/openapi.yaml @@ -8,6 +8,10 @@ tags: description: Внешний сервер - name : PrivilegeInternal description: Внутренний сервер + - name: TariffExternal + description: Внешний сервер + - name: TariffInternal + description: Внутренний сервер paths: /privilege/service: get: @@ -254,6 +258,172 @@ paths: $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: @@ -350,6 +520,61 @@ components: 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