update openapi

This commit is contained in:
Pavel 2024-04-23 14:18:45 +03:00
parent f669d1cc71
commit 16a3779df5
2 changed files with 92 additions and 28 deletions

@ -1,8 +1,6 @@
package controllers
import (
"amocrm/internal/repository"
"errors"
"github.com/gofiber/fiber/v2"
"go.uber.org/zap"
"penahub.gitlab.yandexcloud.net/backend/quiz/core.git/middleware"
@ -65,12 +63,8 @@ func (c *Controller) GetCurrentAccount(ctx *fiber.Ctx) error {
response, err := c.service.GetCurrentAccount(ctx.Context(), accountID)
if err != nil {
switch {
case errors.Is(err, repository.ErrUserNotFound):
return ctx.Status(fiber.StatusNotFound).SendString("User not found")
default:
return ctx.Status(fiber.StatusInternalServerError).SendString("Internal Server Error")
}
return ctx.Status(fiber.StatusInternalServerError).SendString("Internal Server Error")
}
return ctx.Status(fiber.StatusOK).JSON(response)
}

@ -53,8 +53,6 @@ paths:
$ref: '#/components/schemas/GetCurrentAccountResp'
'401':
$ref: '#/components/responses/401'
'404':
$ref: '#/components/responses/404'
'500':
$ref: '#/components/responses/500'
/webhook/create:
@ -108,15 +106,15 @@ paths:
- size
responses:
'200':
description: успешное получение списка пользователей
description: успешное получение заданных юзером utm меток
content:
'application/json':
schema:
$ref: '#/components/schemas/GetListUserUTMResp'
'401':
$ref: '#/components/responses/401'
'404':
$ref: '#/components/responses/404'
'400':
$ref: '#/components/responses/400'
'500':
$ref: '#/components/responses/500'
post:
@ -145,8 +143,8 @@ paths:
$ref: '#/components/schemas/ListSavedIDUTMResp'
'401':
$ref: '#/components/responses/401'
'404':
$ref: '#/components/responses/404'
'400':
$ref: '#/components/responses/400'
'500':
$ref: '#/components/responses/500'
delete:
@ -168,11 +166,9 @@ paths:
$ref: '#/components/schemas/ListDeleteUTMIDsReq'
responses:
'200':
description: Success
'401':
$ref: '#/components/responses/401'
'404':
$ref: '#/components/responses/404'
$ref: '#/components/responses/200'
'400':
$ref: '#/components/responses/400'
'500':
$ref: '#/components/responses/500'
/users:
@ -207,6 +203,10 @@ paths:
'application/json':
schema:
$ref: "#/components/schemas/UserListResp"
'401':
$ref: '#/components/responses/401'
'500':
$ref: '#/components/responses/500'
patch:
operationId: UpdateListUsers
description: обновление списка юзеров
@ -214,7 +214,11 @@ paths:
- main
responses:
'200':
description: Success
$ref: '#/components/responses/200'
'401':
$ref: '#/components/responses/401'
'500':
$ref: '#/components/responses/500'
/pipelines:
get:
operationId: GettingPipelinesFromCash
@ -247,6 +251,10 @@ paths:
'application/json':
schema:
$ref: "#/components/schemas/UserListPipelinesResp"
'401':
$ref: '#/components/responses/401'
'500':
$ref: '#/components/responses/500'
patch:
operationId: UpdateListPipelines
description: обновление списка воронок
@ -254,7 +262,11 @@ paths:
- main
responses:
'200':
description: Success
$ref: '#/components/responses/200'
'401':
$ref: '#/components/responses/401'
'500':
$ref: '#/components/responses/500'
/steps:
get:
operationId: GettingStepsFromCash
@ -287,6 +299,10 @@ paths:
'application/json':
schema:
$ref: "#/components/schemas/UserListStepsResp"
'401':
$ref: '#/components/responses/401'
'500':
$ref: '#/components/responses/500'
patch:
operationId: UpdateListSteps
description: обновление списка этапов воронок
@ -294,7 +310,11 @@ paths:
- main
responses:
'200':
description: Success
$ref: '#/components/responses/200'
'401':
$ref: '#/components/responses/401'
'500':
$ref: '#/components/responses/500'
/fields:
get:
operationId: GettingFieldsFromCash
@ -327,6 +347,10 @@ paths:
'application/json':
schema:
$ref: "#/components/schemas/UserListFieldsResp"
'401':
$ref: '#/components/responses/401'
'500':
$ref: '#/components/responses/500'
patch:
operationId: UpdateListCustom
description: обновление списка кастомных полей
@ -334,7 +358,11 @@ paths:
- main
responses:
'200':
description: Success
$ref: '#/components/responses/200'
'401':
$ref: '#/components/responses/401'
'500':
$ref: '#/components/responses/500'
/tags:
get:
operationId: GettingTagsFromCash
@ -367,6 +395,10 @@ paths:
'application/json':
schema:
$ref: "#/components/schemas/UserListTagsResp"
'401':
$ref: '#/components/responses/401'
'500':
$ref: '#/components/responses/500'
patch:
operationId: UpdateListTags
description: обновление списка тегов
@ -374,7 +406,11 @@ paths:
- main
responses:
'200':
description: Success
$ref: '#/components/responses/200'
'401':
$ref: '#/components/responses/401'
'500':
$ref: '#/components/responses/500'
# таких запросах для блупринта обязательно нужно указывать параметры
/rules/{quizID}:
get:
@ -818,9 +854,43 @@ components:
RulesReq:
type: object
properties:
ID:
type: string
description: ID квиза
PerformerID:
type: integer
description: "айдишник ответственного за сделку"
PipelineID:
type: integer
description: "айдишник воронки"
StepID:
type: integer
description: "айдишник этапа"
Utms:
type: array
items:
type: integer
description: "список UTM для этого опроса"
Fieldsrule:
type: object
properties:
Lead:
type: array
items:
$ref: "#/components/schemas/FieldRule"
description: "правила заполнения полей сущностей в амо"
Contact:
type: array
items:
$ref: "#/components/schemas/FieldRule"
description: "правила заполнения полей сущностей в амо"
Company:
type: array
items:
$ref: "#/components/schemas/FieldRule"
description: "правила заполнения полей сущностей в амо"
Customer:
type: array
items:
$ref: "#/components/schemas/FieldRule"
description: "правила заполнения полей сущностей в амо"
responses:
'200':