diff --git a/v2/swagger.yaml b/v2/swagger.yaml index db39345..4bf63e0 100644 --- a/v2/swagger.yaml +++ b/v2/swagger.yaml @@ -63,6 +63,10 @@ tags: description: Methods for working with workflow. - name: kedo description: Методы для работы с КЭДО. + - name: survey + description: Опросы — прохождение, назначения, отчёты 360. Требуется право survey-participate. + - name: survey-admin + description: Опросы — административный API. Требуется одно из прав surveys-edit / surveys-360-edit / surveys-icsi-edit / surveys-feedback-edit. - name: admin-wallet description: Methods for admin access to employee wallets (read-only). Requires "wallets-transactions" permission and enableWallet tenant flag. - name: admin-wallet-transaction @@ -5605,6 +5609,7 @@ paths: responses: 200: + description: OK content: application/json: schema: @@ -5712,6 +5717,7 @@ paths: format: integer responses: 200: + description: OK content: application/json: schema: @@ -5757,6 +5763,7 @@ paths: type: boolean responses: 200: + description: OK content: application/json: schema: @@ -5797,6 +5804,7 @@ paths: operationId: /survey-report/360 responses: 200: + description: OK content: application/json: schema: @@ -5846,6 +5854,1210 @@ paths: 500: description: Server Error. + # ── User survey: новые эндпоинты H-3823 ───────────────────────────────────── + + /survey/start: + post: + tags: + - survey + summary: Запустить опрос (создать self-assignment) + operationId: /survey/start + requestBody: + required: true + content: + application/json: + schema: + type: object + required: [id] + properties: + id: + type: string + format: uuid + description: ID опроса + survey_target_id: + type: string + format: uuid + description: ID цели (опционально, для групповых/360) + survey360_matrix_position_id: + type: string + format: uuid + is_anonymous: + type: boolean + description: Анонимное прохождение (если опрос поддерживает) + responses: + 200: + description: Назначение создано + content: + application/json: + schema: + $ref: '#/components/schemas/httpJsonResult' + 401: + description: Unauthorized. + 403: + description: Forbidden. + 422: + description: Validation error. + + /survey/questions: + get: + tags: + - survey + summary: Вопросы опроса для текущего пользователя + operationId: /survey/questions + parameters: + - name: id + in: query + required: true + description: ID опроса + schema: + type: string + format: uuid + - name: survey_target_id + in: query + description: ID цели (опционально) + schema: + type: string + format: uuid + responses: + 200: + description: Данные плеера опроса + content: + application/json: + schema: + $ref: '#/components/schemas/surveyPlayerData' + 401: + description: Unauthorized. + 403: + description: Forbidden (опрос уже завершён). + + /survey/answer: + post: + tags: + - survey + summary: Сохранение ответов (batch) + operationId: /survey/answer + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + type: object + properties: + question_id: + type: string + format: uuid + survey_assignment_id: + type: string + format: uuid + choices: + type: array + items: + type: string + format: uuid + score: + type: number + comment: + type: string + responses: + 201: + description: Ответы сохранены (тело пустое). + 401: + description: Unauthorized. + 422: + description: Validation error. + + /survey/finish: + post: + tags: + - survey + summary: Завершить прохождение опроса + operationId: /survey/finish + parameters: + - name: survey_assignment_id + in: query + required: true + schema: + type: string + format: uuid + responses: + 200: + description: Результат завершения + content: + application/json: + schema: + $ref: '#/components/schemas/httpJsonResult' + 401: + description: Unauthorized. + 404: + description: Назначение не найдено. + + # ── Admin survey: H-3823 ────────────────────────────────────────────────────── + + /admin/survey/survey-template/index: + get: + tags: + - survey-admin + summary: Список шаблонов опросов (только текущие версии) + operationId: /admin/survey/survey-template/index + parameters: + - name: type_id + in: query + description: "Тип опроса: 1-Обычный, 2-ICSI, 360-360, 5-Пульс, 6-Обратная связь" + schema: + type: integer + - name: name + in: query + schema: + type: string + - name: per-page + in: query + schema: + type: integer + default: 25 + - name: page + in: query + schema: + type: integer + default: 1 + responses: + 200: + description: OK + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/surveyTemplate' + _links: + $ref: '#/components/schemas/_links' + _meta: + $ref: '#/components/schemas/_meta' + 401: + description: Unauthorized. + 403: + description: Forbidden. + + /admin/survey/survey-template/view: + get: + tags: + - survey-admin + summary: Детали шаблона + operationId: /admin/survey/survey-template/view + parameters: + - name: id + in: query + required: true + description: ID версии шаблона + schema: + type: string + format: uuid + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/surveyTemplate' + 404: + description: Not found. + + /admin/survey/survey-template/edit: + post: + tags: + - survey-admin + summary: Создать или обновить шаблон + operationId: /admin/survey/survey-template/edit + parameters: + - name: id + in: query + description: ID версии (не передавать для создания) + schema: + type: string + format: uuid + requestBody: + content: + application/json: + schema: + type: object + required: [name, type_id] + properties: + name: + type: string + type_id: + type: integer + questions: + type: array + items: + type: object + before_content: + type: object + after_content: + type: object + responses: + 200: + description: Сохранено + content: + application/json: + schema: + $ref: '#/components/schemas/httpJsonResult' + 422: + description: Validation error. + + /admin/survey/survey-template/delete: + delete: + tags: + - survey-admin + summary: Удалить шаблон + operationId: /admin/survey/survey-template/delete + parameters: + - name: id + in: query + required: true + description: ID шаблона (SurveyTemplate, не версии) + schema: + type: string + format: uuid + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/httpJsonResult' + 404: + description: Not found. + + /admin/survey/survey-template/create-survey: + post: + tags: + - survey-admin + summary: Создать сессию опроса из шаблона + operationId: /admin/survey/survey-template/create-survey + parameters: + - name: id + in: query + required: true + description: ID версии шаблона + schema: + type: string + format: uuid + responses: + 200: + description: OK + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/httpJsonResult' + - type: object + properties: + data: + type: object + properties: + surveyId: + type: string + format: uuid + + /admin/survey/survey-template/create-survey-auto: + post: + tags: + - survey-admin + summary: Создать авто-опрос из шаблона + operationId: /admin/survey/survey-template/create-survey-auto + parameters: + - name: id + in: query + required: true + schema: + type: string + format: uuid + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/httpJsonResult' + + /admin/survey/survey/index: + get: + tags: + - survey-admin + summary: Список опросов (admin) + operationId: /admin/survey/survey/index + parameters: + - name: type_id + in: query + schema: + type: integer + - name: survey_status_id + in: query + description: "Статус: 1-Завершён, 2-Запущен, 3-Готов к запуску, 4-Ожидает, 5-Черновик" + schema: + type: integer + - name: name + in: query + schema: + type: string + - name: per-page + in: query + schema: + type: integer + default: 25 + - name: page + in: query + schema: + type: integer + responses: + 200: + description: OK + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/adminSurvey' + _links: + $ref: '#/components/schemas/_links' + _meta: + $ref: '#/components/schemas/_meta' + + /admin/survey/survey/view: + get: + tags: + - survey-admin + summary: Детали опроса (admin) + operationId: /admin/survey/survey/view + parameters: + - name: id + in: query + required: true + schema: + type: string + format: uuid + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/adminSurvey' + 404: + description: Not found. + + /admin/survey/survey/edit: + post: + tags: + - survey-admin + summary: Создать или обновить опрос + operationId: /admin/survey/survey/edit + parameters: + - name: id + in: query + description: ID опроса (не передавать для создания) + schema: + type: string + format: uuid + requestBody: + content: + application/json: + schema: + type: object + properties: + name: + type: string + survey_template_version_id: + type: string + format: uuid + survey_status_id: + type: integer + is_available: + type: boolean + deadline_at: + type: string + format: date-time + available_date: + type: string + format: date-time + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/httpJsonResult' + 422: + description: Validation error. + + /admin/survey/survey/delete: + delete: + tags: + - survey-admin + summary: Удалить опрос (только DRAFT/AWAIT/READY_LAUNCH) + operationId: /admin/survey/survey/delete + parameters: + - name: id + in: query + required: true + schema: + type: string + format: uuid + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/httpJsonResult' + + /admin/survey/survey/launch: + post: + tags: + - survey-admin + summary: Запустить опрос (отправить в очередь goworker) + operationId: /admin/survey/survey/launch + parameters: + - name: id + in: query + required: true + schema: + type: string + format: uuid + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/httpJsonResult' + + /admin/survey/survey/complete: + post: + tags: + - survey-admin + summary: Завершить опрос досрочно + operationId: /admin/survey/survey/complete + parameters: + - name: id + in: query + required: true + schema: + type: string + format: uuid + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/httpJsonResult' + + /admin/survey/survey/extend: + post: + tags: + - survey-admin + summary: Продлить завершённый опрос (вернуть в READY_LAUNCH) + operationId: /admin/survey/survey/extend + parameters: + - name: id + in: query + required: true + schema: + type: string + format: uuid + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/httpJsonResult' + + /admin/survey/survey/upgrade-version: + post: + tags: + - survey-admin + summary: Обновить шаблон опроса до новой версии (сбросить ответы) + operationId: /admin/survey/survey/upgrade-version + parameters: + - name: id + in: query + required: true + schema: + type: string + format: uuid + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/httpJsonResult' + + /admin/survey/survey-auto/index: + get: + tags: + - survey-admin + summary: Список авто-опросов + operationId: /admin/survey/survey-auto/index + parameters: + - name: type_id + in: query + schema: + type: integer + - name: per-page + in: query + schema: + type: integer + default: 25 + - name: page + in: query + schema: + type: integer + responses: + 200: + description: OK + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/adminSurvey' + _links: + $ref: '#/components/schemas/_links' + _meta: + $ref: '#/components/schemas/_meta' + + /admin/survey/survey-auto/view: + get: + tags: + - survey-admin + summary: Детали авто-опроса + operationId: /admin/survey/survey-auto/view + parameters: + - name: id + in: query + required: true + schema: + type: string + format: uuid + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/adminSurvey' + + /admin/survey/survey-auto/edit: + post: + tags: + - survey-admin + summary: Создать или обновить авто-опрос + operationId: /admin/survey/survey-auto/edit + parameters: + - name: id + in: query + schema: + type: string + format: uuid + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/httpJsonResult' + + /admin/survey/survey-auto/delete: + delete: + tags: + - survey-admin + summary: Удалить авто-опрос + operationId: /admin/survey/survey-auto/delete + parameters: + - name: id + in: query + required: true + schema: + type: string + format: uuid + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/httpJsonResult' + + /admin/survey/survey-auto/sessions: + get: + tags: + - survey-admin + summary: Список сессий авто-опроса + operationId: /admin/survey/survey-auto/sessions + parameters: + - name: id + in: query + required: true + description: ID авто-опроса + schema: + type: string + format: uuid + - name: per-page + in: query + schema: + type: integer + default: 25 + - name: page + in: query + schema: + type: integer + responses: + 200: + description: OK + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/adminSurvey' + _links: + $ref: '#/components/schemas/_links' + _meta: + $ref: '#/components/schemas/_meta' + + /admin/survey/survey-assignment/index: + get: + tags: + - survey-admin + summary: Список назначений (admin) + operationId: /admin/survey/survey-assignment/index + parameters: + - name: survey_id + in: query + schema: + type: string + format: uuid + - name: user_id + in: query + schema: + type: string + format: uuid + - name: survey_assignment_status_id + in: query + schema: + type: integer + - name: per-page + in: query + schema: + type: integer + default: 25 + - name: page + in: query + schema: + type: integer + responses: + 200: + description: OK + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/adminSurveyAssignment' + _links: + $ref: '#/components/schemas/_links' + _meta: + $ref: '#/components/schemas/_meta' + + /admin/survey/survey-assignment/view: + get: + tags: + - survey-admin + summary: Детали назначения (admin) + operationId: /admin/survey/survey-assignment/view + parameters: + - name: id + in: query + required: true + schema: + type: string + format: uuid + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/adminSurveyAssignment' + + /admin/survey/survey-assignment/add-targets: + post: + tags: + - survey-admin + summary: Добавить цели (участников) к опросу + operationId: /admin/survey/survey-assignment/add-targets + parameters: + - name: survey_id + in: query + required: true + schema: + type: string + format: uuid + - name: entity_id + in: query + required: true + description: "ID типа сущности (20 = User)" + schema: + type: integer + example: 20 + requestBody: + required: true + content: + application/json: + schema: + type: array + description: Массив UUID участников/сущностей + items: + type: string + format: uuid + responses: + 200: + description: OK + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/httpJsonResult' + - type: object + properties: + data: + type: object + properties: + count: + type: integer + description: Количество добавленных записей + + /admin/survey/survey-assignment/remove-targets: + delete: + tags: + - survey-admin + summary: Удалить цели из опроса + operationId: /admin/survey/survey-assignment/remove-targets + parameters: + - name: survey_id + in: query + required: true + schema: + type: string + format: uuid + - name: entity_id + in: query + required: true + schema: + type: integer + requestBody: + required: true + content: + application/json: + schema: + type: array + items: + type: string + format: uuid + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/httpJsonResult' + + /admin/survey/survey-report/results: + get: + tags: + - survey-admin + summary: Данные отчёта по опросу + operationId: /admin/survey/survey-report/results + parameters: + - name: survey_id + in: query + required: true + schema: + type: string + format: uuid + - name: survey_type_id + in: query + required: true + schema: + type: integer + - name: type + in: query + required: true + description: "Тип отчёта: choices, users, targets, target, targetsCommon, swot" + schema: + type: string + enum: [choices, users, targets, target, targetsCommon, swot] + - name: survey_target_id + in: query + schema: + type: string + format: uuid + - name: survey360_matrix_position_id + in: query + schema: + type: string + format: uuid + responses: + 200: + description: Данные отчёта (структура зависит от type) + content: + application/json: + schema: + type: object + 422: + description: Validation error. + + /admin/survey/survey-report/export-excel: + post: + tags: + - survey-admin + summary: Поставить excel-выгрузку в очередь + operationId: /admin/survey/survey-report/export-excel + parameters: + - name: survey_id + in: query + schema: + type: string + format: uuid + - name: survey_type_id + in: query + schema: + type: integer + - name: type + in: query + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + columns: + type: array + items: + type: string + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/httpJsonResult' + + /admin/survey/survey-report/access-give: + post: + tags: + - survey-admin + summary: Открыть доступ к отчёту для участников + operationId: /admin/survey/survey-report/access-give + parameters: + - name: survey_id + in: query + required: true + schema: + type: string + format: uuid + requestBody: + content: + application/json: + schema: + type: object + properties: + ids: + type: array + description: ID SurveyTarget (пусто = все) + items: + type: string + format: uuid + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/httpJsonResult' + + /admin/survey/survey-report/access-disable: + post: + tags: + - survey-admin + summary: Закрыть доступ к отчёту + operationId: /admin/survey/survey-report/access-disable + parameters: + - name: survey_id + in: query + required: true + schema: + type: string + format: uuid + requestBody: + content: + application/json: + schema: + type: object + properties: + ids: + type: array + items: + type: string + format: uuid + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/httpJsonResult' + + /admin/survey/survey-360/index: + get: + tags: + - survey-admin + summary: Список матриц 360 + operationId: /admin/survey/survey-360/index + parameters: + - name: is_approved + in: query + schema: + type: boolean + - name: modification_status_id + in: query + schema: + type: integer + - name: per-page + in: query + schema: + type: integer + default: 25 + - name: page + in: query + schema: + type: integer + responses: + 200: + description: OK + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/survey360Matrix' + _links: + $ref: '#/components/schemas/_links' + _meta: + $ref: '#/components/schemas/_meta' + + /admin/survey/survey-360/view: + get: + tags: + - survey-admin + summary: Детали матрицы 360 + operationId: /admin/survey/survey-360/view + parameters: + - name: id + in: query + required: true + schema: + type: string + format: uuid + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/survey360Matrix' + + /admin/survey/survey-360/approve: + post: + tags: + - survey-admin + summary: Утвердить матрицы 360 + operationId: /admin/survey/survey-360/approve + requestBody: + content: + application/json: + schema: + type: object + properties: + ids: + type: array + description: ID матриц (пусто = все завершённые) + items: + type: string + format: uuid + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/httpJsonResult' + + /admin/survey/survey-360/update: + post: + tags: + - survey-admin + summary: Обновить матрицу 360 (участников) + operationId: /admin/survey/survey-360/update + parameters: + - name: id + in: query + required: true + schema: + type: string + format: uuid + requestBody: + content: + application/json: + schema: + type: object + properties: + is_approved: + type: boolean + survey360MatrixUsers: + type: array + items: + type: object + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/httpJsonResult' + + /admin/survey/survey-360/access-give: + post: + tags: + - survey-admin + summary: Открыть доступ к отчёту 360 + operationId: /admin/survey/survey-360/access-give + parameters: + - name: survey_id + in: query + required: true + schema: + type: string + format: uuid + requestBody: + content: + application/json: + schema: + type: object + properties: + ids: + type: array + items: + type: string + format: uuid + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/httpJsonResult' + + /admin/survey/survey-360/access-disable: + post: + tags: + - survey-admin + summary: Закрыть доступ к отчёту 360 + operationId: /admin/survey/survey-360/access-disable + parameters: + - name: survey_id + in: query + required: true + schema: + type: string + format: uuid + requestBody: + content: + application/json: + schema: + type: object + properties: + ids: + type: array + items: + type: string + format: uuid + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/httpJsonResult' + + /admin/survey/survey-360/export-excel: + post: + tags: + - survey-admin + summary: Excel-выгрузка матриц 360 + operationId: /admin/survey/survey-360/export-excel + parameters: + - name: survey_id + in: query + required: true + schema: + type: string + format: uuid + requestBody: + content: + application/json: + schema: + type: object + properties: + columns: + type: array + items: + type: string + responses: + 200: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/httpJsonResult' + /instruction/index: get: tags: @@ -13895,6 +15107,241 @@ components: $ref: '#/components/schemas/GoalItem' description: Цели которые не были обработаны + httpJsonResult: + type: object + description: Стандартный ответ API v2 + properties: + success: + type: boolean + description: Результат операции + data: + description: Данные ответа (null или объект) + nullable: true + errors: + type: array + description: Ошибки валидации + items: + type: string + message: + nullable: true + type: object + properties: + type: + type: string + enum: [success, error, info, warning] + text: + type: string + + surveyTemplate: + type: object + description: Шаблон опроса (текущая версия) + properties: + id: + type: string + format: uuid + survey_template_id: + type: string + format: uuid + name: + type: string + description: Название шаблона + type_id: + type: integer + description: "Тип: 1-Обычный, 2-ICSI, 360-360, 5-Пульс, 6-Обратная связь" + type_name: + type: string + version: + type: integer + version_label: + type: string + created_at_localized: + type: string + updated_at_localized: + type: string + created_user_id: + type: string + format: uuid + + adminSurvey: + type: object + description: Опрос (admin view) + properties: + id: + type: string + format: uuid + name: + type: string + type_id: + type: integer + type_name: + type: string + survey_status_id: + type: integer + description: "1-Завершён, 2-Запущен, 3-Готов к запуску, 4-Ожидает, 5-Черновик" + status_name: + type: string + is_auto: + type: boolean + is_available: + type: boolean + survey_auto_type_id: + type: integer + nullable: true + surveyAutoTypeName: + type: string + nullable: true + deadline_at: + type: string + format: date-time + nullable: true + deadline_at_localized: + type: string + nullable: true + available_date: + type: string + format: date-time + nullable: true + available_date_localized: + type: string + nullable: true + created_at_localized: + type: string + survey_template_version_id: + type: string + format: uuid + nullable: true + + adminSurveyAssignment: + type: object + description: Назначение на опрос (admin view) + properties: + id: + type: string + format: uuid + survey_id: + type: string + format: uuid + survey_target_id: + type: string + format: uuid + nullable: true + survey360_matrix_position_id: + type: string + format: uuid + nullable: true + survey_assignment_status_id: + type: integer + surveyAssignmentStatusName: + type: string + survey360MatrixPositionName: + type: string + nullable: true + is_anonymous: + type: boolean + is_finished: + type: boolean + started_at_localized: + type: string + nullable: true + finished_at_localized: + type: string + nullable: true + created_at_localized: + type: string + + survey360Matrix: + type: object + description: Матрица 360 + properties: + id: + type: string + format: uuid + user_id: + type: string + format: uuid + is_approved: + type: boolean + approved_by_user_id: + type: string + format: uuid + nullable: true + modification_status_id: + type: integer + description: "0-не нужна, 1-нужна, 2-завершена" + modification_role_id: + type: integer + nullable: true + modificationStatusName: + type: string + modificationRoleName: + type: string + nullable: true + approvedAtLocalized: + type: string + nullable: true + modificationAtLocalized: + type: string + nullable: true + isNeedModification: + type: boolean + isCompletedModification: + type: boolean + isNotNeedModification: + type: boolean + isCurrentUser: + type: boolean + + surveyPlayerData: + type: object + description: Данные для плеера опроса + properties: + beforeContentHtml: + type: string + nullable: true + description: HTML-текст перед началом опроса + afterContentHtml: + type: string + nullable: true + description: HTML-текст после завершения опроса + questions: + type: array + items: + type: object + properties: + id: + type: string + format: uuid + type: + type: string + description: "Тип вопроса: choice, scale, text, etc." + name: + type: string + description: Текст вопроса + required: + type: boolean + scored: + type: boolean + commented: + type: boolean + comment_required: + type: boolean + sort: + type: integer + choices: + type: array + nullable: true + items: + type: object + properties: + id: + type: string + format: uuid + name: + type: string + score: + type: number + nullable: true + security: - SessionAuth: [ ] - ApiKeyAuth: [ ]