Add doc for tests
This commit is contained in:
parent
aae845aee7
commit
3e575dcf8b
@ -29,6 +29,33 @@ class AnswerController extends ApiController
|
||||
}
|
||||
|
||||
/**
|
||||
* @OA\Get(path="/answer/get-answers",
|
||||
* summary="Список ответов на вопрос",
|
||||
* description="Получение списка ответов",
|
||||
* security={
|
||||
* {"bearerAuth": {}}
|
||||
* },
|
||||
* tags={"Tests"},
|
||||
* @OA\Parameter(
|
||||
* name="question_id",
|
||||
* in="query",
|
||||
* required=true,
|
||||
* description="id вопроса",
|
||||
* @OA\Schema(
|
||||
* type="integer",
|
||||
* )
|
||||
* ),
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="Возвращает масив вопросов",
|
||||
* @OA\MediaType(
|
||||
* mediaType="application/json",
|
||||
* @OA\Schema(ref="#/components/schemas/AnswerExampleArr"),
|
||||
* ),
|
||||
*
|
||||
* ),
|
||||
* )
|
||||
*
|
||||
* @throws NotFoundHttpException
|
||||
*/
|
||||
public function actionGetAnswers(): array
|
||||
|
@ -29,6 +29,34 @@ class QuestionController extends ApiController
|
||||
}
|
||||
|
||||
/**
|
||||
* @OA\Get(path="/question/get-questions",
|
||||
* summary="Список вопросов",
|
||||
* description="Получение списка вопросов",
|
||||
* security={
|
||||
* {"bearerAuth": {}}
|
||||
* },
|
||||
* tags={"Tests"},
|
||||
* @OA\Parameter(
|
||||
* name="user",
|
||||
* in="query",
|
||||
* required=true,
|
||||
* description="UUID анкеты назначеной пользователю",
|
||||
* @OA\Schema(
|
||||
* type="integer",
|
||||
* )
|
||||
* ),
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="Возвращает масив вопросов",
|
||||
* @OA\MediaType(
|
||||
* mediaType="application/json",
|
||||
* @OA\Schema(ref="#/components/schemas/QuestionExampleArr"),
|
||||
* ),
|
||||
*
|
||||
*
|
||||
* ),
|
||||
* )
|
||||
*
|
||||
* @throws NotFoundHttpException
|
||||
* @throws \Exception
|
||||
*/
|
||||
|
@ -27,6 +27,34 @@ class UserQuestionnaireController extends ApiController
|
||||
}
|
||||
|
||||
/**
|
||||
* @OA\Get(path="/user-questionnaire/questionnaires-list",
|
||||
* summary="Список тестов",
|
||||
* description="Получение списка тестов",
|
||||
* security={
|
||||
* {"bearerAuth": {}}
|
||||
* },
|
||||
* tags={"Tests"},
|
||||
* @OA\Parameter(
|
||||
* name="user_id",
|
||||
* in="query",
|
||||
* required=true,
|
||||
* @OA\Schema(
|
||||
* type="integer",
|
||||
* )
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="Возвращает массив объектов тест",
|
||||
* @OA\MediaType(
|
||||
* mediaType="application/json",
|
||||
* @OA\Schema(ref="#/components/schemas/UserQuestionnaireArrExample"),
|
||||
* ),
|
||||
* ),
|
||||
*
|
||||
* ),
|
||||
* )
|
||||
*
|
||||
* @throws NotFoundHttpException
|
||||
*/
|
||||
public function actionQuestionnairesList($user_id): array
|
||||
@ -42,6 +70,32 @@ class UserQuestionnaireController extends ApiController
|
||||
}
|
||||
|
||||
/**
|
||||
* @OA\Get(path="/user-questionnaire/questionnaire-completed",
|
||||
* summary="Проверка теста",
|
||||
* description="Выполнения проверки теста",
|
||||
* security={
|
||||
* {"bearerAuth": {}}
|
||||
* },
|
||||
* tags={"Tests"},
|
||||
* @OA\Parameter(
|
||||
* name="user_questionnaire_uuid",
|
||||
* in="query",
|
||||
* required=true,
|
||||
* @OA\Schema(
|
||||
* type="string",
|
||||
* )
|
||||
* ),
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="Возвращает объект Запроса",
|
||||
* @OA\MediaType(
|
||||
* mediaType="application/json",
|
||||
* @OA\Schema(ref="#/components/schemas/UserQuestionnaireExample"),
|
||||
* ),
|
||||
*
|
||||
* ),
|
||||
* )
|
||||
*
|
||||
* @throws NotFoundHttpException
|
||||
* @throws ServerErrorHttpException
|
||||
*/
|
||||
@ -55,6 +109,37 @@ class UserQuestionnaireController extends ApiController
|
||||
}
|
||||
|
||||
/**
|
||||
* @OA\Get(path="/user-questionnaire/get-points-number",
|
||||
* summary="Количество балов в тесте",
|
||||
* description="Возвращает максимальное количество балов за тест",
|
||||
* security={
|
||||
* {"bearerAuth": {}}
|
||||
* },
|
||||
* tags={"Tests"},
|
||||
* @OA\Parameter(
|
||||
* name="user_questionnaire_uuid",
|
||||
* in="query",
|
||||
* required=true,
|
||||
* @OA\Schema(
|
||||
* type="string",
|
||||
* )
|
||||
* ),
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="Возвращает максимально возможное количество балов за тест",
|
||||
* @OA\MediaType(
|
||||
* mediaType="application/json",
|
||||
* @OA\Schema(
|
||||
* @OA\Property(
|
||||
* property="sum_point",
|
||||
* type="integer",
|
||||
* example="61",
|
||||
* ),
|
||||
* ),
|
||||
* ),
|
||||
*
|
||||
* ),
|
||||
* )
|
||||
* @throws ServerErrorHttpException
|
||||
*/
|
||||
public function actionGetPointsNumber($user_questionnaire_uuid)
|
||||
@ -67,6 +152,37 @@ class UserQuestionnaireController extends ApiController
|
||||
}
|
||||
|
||||
/**
|
||||
* @OA\Get(path="/user-questionnaire/get-question-number",
|
||||
* summary="Число вопросов в тесте",
|
||||
* description="Возвращает число вопросов в тесте",
|
||||
* security={
|
||||
* {"bearerAuth": {}}
|
||||
* },
|
||||
* tags={"Tests"},
|
||||
* @OA\Parameter(
|
||||
* name="user_questionnaire_uuid",
|
||||
* in="query",
|
||||
* required=true,
|
||||
* @OA\Schema(
|
||||
* type="string",
|
||||
* )
|
||||
* ),
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="Возвращает число вопросов в тесте",
|
||||
* @OA\MediaType(
|
||||
* mediaType="application/json",
|
||||
* @OA\Schema(
|
||||
* @OA\Property(
|
||||
* property="question_number",
|
||||
* type="integer",
|
||||
* example="61",
|
||||
* ),
|
||||
* ),
|
||||
* ),
|
||||
*
|
||||
* ),
|
||||
* )
|
||||
* @throws ServerErrorHttpException
|
||||
*/
|
||||
public function actionGetQuestionNumber($user_questionnaire_uuid)
|
||||
|
@ -20,6 +20,61 @@ class UserResponseController extends ApiController
|
||||
}
|
||||
|
||||
/**
|
||||
* @OA\Post(path="/user-response/set-response",
|
||||
* summary="Добавить ответ пользователя",
|
||||
* description="Добавление ответа на вопрос от пользователя",
|
||||
* security={
|
||||
* {"bearerAuth": {}}
|
||||
* },
|
||||
* tags={"Tests"},
|
||||
* @OA\Parameter(
|
||||
* name="user_id",
|
||||
* in="query",
|
||||
* required=true,
|
||||
* description="ID пользователя",
|
||||
* @OA\Schema(
|
||||
* type="integer",
|
||||
* )
|
||||
* ),
|
||||
* @OA\Parameter(
|
||||
* name="question_id",
|
||||
* in="query",
|
||||
* required=true,
|
||||
* description="ID вопроса",
|
||||
* @OA\Schema(
|
||||
* type="integer",
|
||||
* )
|
||||
* ),
|
||||
* @OA\Parameter(
|
||||
* name="response_body",
|
||||
* in="query",
|
||||
* required=true,
|
||||
* description="Ответ пользователя",
|
||||
* @OA\Schema(
|
||||
* type="string",
|
||||
* )
|
||||
* ),
|
||||
* @OA\Parameter(
|
||||
* name="user_questionnaire_uuid",
|
||||
* in="query",
|
||||
* required=true,
|
||||
* description="UUID анкеты назначенной пользователю",
|
||||
* @OA\Schema(
|
||||
* type="string",
|
||||
* )
|
||||
* ),
|
||||
*
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="Возвращает ответ",
|
||||
* @OA\MediaType(
|
||||
* mediaType="application/json",
|
||||
* @OA\Schema(ref="#/components/schemas/UserResponseExample"),
|
||||
* ),
|
||||
* ),
|
||||
* )
|
||||
*
|
||||
* @throws InvalidConfigException
|
||||
* @throws ServerErrorHttpException|BadRequestHttpException
|
||||
*/
|
||||
@ -33,6 +88,53 @@ class UserResponseController extends ApiController
|
||||
}
|
||||
|
||||
/**
|
||||
* @OA\Post(path="/user-response/set-responses",
|
||||
* summary="Добавить массив ответов пользователя",
|
||||
* description="Добавление массива ответов на вопросы от пользователя",
|
||||
* security={
|
||||
* {"bearerAuth": {}}
|
||||
* },
|
||||
* tags={"Tests"},
|
||||
* @OA\RequestBody(
|
||||
* @OA\MediaType(
|
||||
* mediaType="application/x-www-form-urlencoded",
|
||||
* @OA\Schema(
|
||||
* required={"request_id"},
|
||||
* @OA\Property(
|
||||
* property="user_id",
|
||||
* type="integer",
|
||||
* description="Идентификатор пользователя",
|
||||
* nullable=false,
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="question_id",
|
||||
* type="integer",
|
||||
* description="Идентификатор вопроса",
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="response_body",
|
||||
* type="string",
|
||||
* description="UUID анкеты назначенной пользователю",
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="user_questionnaire_uuid",
|
||||
* type="string",
|
||||
* description="UUID анкеты назначенной пользователю",
|
||||
* ),
|
||||
* ),
|
||||
* ),
|
||||
* ),
|
||||
*
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="Возвращает объект Запроса",
|
||||
* @OA\MediaType(
|
||||
* mediaType="application/json",
|
||||
* @OA\Schema(ref="#/components/schemas/UserResponseExampleArr"),
|
||||
* ),
|
||||
* ),
|
||||
* )
|
||||
*
|
||||
* @throws InvalidConfigException
|
||||
* @throws ServerErrorHttpException|BadRequestHttpException
|
||||
*/
|
||||
|
59
frontend/modules/api/models/Answer.php
Normal file
59
frontend/modules/api/models/Answer.php
Normal file
@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace frontend\modules\api\models;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @OA\Schema(
|
||||
* schema="Answer",
|
||||
* @OA\Property(
|
||||
* property="id",
|
||||
* type="int",
|
||||
* example=1,
|
||||
* description="Идентификатор ответа"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="question_id",
|
||||
* type="int",
|
||||
* example="7",
|
||||
* description="Идентификатор вопроса"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="question_body",
|
||||
* type="string",
|
||||
* example="Вопрос №1",
|
||||
* description="Тело вопроса"
|
||||
* ),
|
||||
*)
|
||||
*
|
||||
*
|
||||
* @OA\Schema(
|
||||
* schema="AnswerExampleArr",
|
||||
* type="array",
|
||||
* example={
|
||||
* {"id": "1", "question_id": 2, "question_body": "Ответ 1",},
|
||||
* {"id": "4", "question_id": 3, "question_body": "Ответ 22",},
|
||||
* },
|
||||
* @OA\Items(
|
||||
* type="object",
|
||||
* @OA\Property(
|
||||
* property="id",
|
||||
* type="integer",
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="question_id",
|
||||
* type="integer",
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="question_body",
|
||||
* type="string",
|
||||
* ),
|
||||
* ),
|
||||
*)
|
||||
*
|
||||
*/
|
||||
class Answer extends \common\models\Answer
|
||||
{
|
||||
|
||||
}
|
89
frontend/modules/api/models/Question.php
Normal file
89
frontend/modules/api/models/Question.php
Normal file
@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
namespace frontend\modules\api\models;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @OA\Schema(
|
||||
* schema="Question",
|
||||
* @OA\Property(
|
||||
* property="id",
|
||||
* type="int",
|
||||
* example=1,
|
||||
* description="Идентификатор вопроса"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="question_type_id",
|
||||
* type="int",
|
||||
* example="2",
|
||||
* description="Тип вопроса: 1 - Открытый вопрос; 2 - Один правильный ответ; 3 - Несколько вариантов ответа; 4 - 'Истина - ложь'"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="question_body",
|
||||
* type="string",
|
||||
* example="Вопрос №1",
|
||||
* description="Тело вопроса"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="question_priority",
|
||||
* type="int",
|
||||
* example="2",
|
||||
* description="Приоритет вопроса"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="next_question",
|
||||
* type="int",
|
||||
* example="5",
|
||||
* description="Следующий вопрос"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="time_limit",
|
||||
* type="string",
|
||||
* example="00:22:00",
|
||||
* description="Лимит времени на ответ"
|
||||
* ),
|
||||
*)
|
||||
*
|
||||
*
|
||||
* @OA\Schema(
|
||||
* schema="QuestionExampleArr",
|
||||
* type="array",
|
||||
* example={
|
||||
* {"id": "1", "question_type_id": 2, "question_body": "Вопрос 1", "question_priority": 1, "next_question": 2, "time_limit": "00:10:00",},
|
||||
* {"id": "4", "question_type_id": 3, "question_body": "Вопрос 22", "question_priority": 4, "next_question": 5, "time_limit": "00:10:00",},
|
||||
* },
|
||||
* @OA\Items(
|
||||
* type="object",
|
||||
* @OA\Property(
|
||||
* property="id",
|
||||
* type="integer",
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="question_type_id",
|
||||
* type="integer",
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="question_body",
|
||||
* type="string",
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="question_priority",
|
||||
* type="integer",
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="next_question",
|
||||
* type="integer",
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="time_limit",
|
||||
* type="string",
|
||||
* ),
|
||||
* ),
|
||||
*)
|
||||
*
|
||||
*/
|
||||
class Question extends \common\models\Question
|
||||
{
|
||||
|
||||
}
|
103
frontend/modules/api/models/UserQuestionnaire.php
Normal file
103
frontend/modules/api/models/UserQuestionnaire.php
Normal file
@ -0,0 +1,103 @@
|
||||
<?php
|
||||
|
||||
namespace frontend\modules\api\models;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @OA\Schema(
|
||||
* schema="UserQuestionnaire",
|
||||
* @OA\Property(
|
||||
* property="user_id",
|
||||
* type="int",
|
||||
* example=1,
|
||||
* description="Идентификатор пользователя"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="uuid",
|
||||
* type="string",
|
||||
* example="d222f858-60fd-47fb-8731-dc9d5fc384c5",
|
||||
* description="uuid"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="score",
|
||||
* type="int",
|
||||
* example="11",
|
||||
* description="Количество балов за тест"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="status",
|
||||
* type="int",
|
||||
* example="2",
|
||||
* description="статус файла"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="percent_correct_answers",
|
||||
* type="float",
|
||||
* example="0.25",
|
||||
* description="Процент правильных ответов"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="testing_date",
|
||||
* type="string",
|
||||
* example="2022-03-17 11:14:22",
|
||||
* description="Дата тестирования"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="questionnaire_title",
|
||||
* type="string",
|
||||
* example="Анкета 1",
|
||||
* description="Название анкеты"
|
||||
* ),
|
||||
*)
|
||||
*
|
||||
* @OA\Schema(
|
||||
* schema="UserQuestionnaireExample",
|
||||
* type="array",
|
||||
* @OA\Items(
|
||||
* type="object",
|
||||
* ref="#/components/schemas/UserQuestionnaire",
|
||||
* ),
|
||||
*)
|
||||
*
|
||||
* @OA\Schema(
|
||||
* schema="UserQuestionnaireArrExample",
|
||||
* type="array",
|
||||
* example={
|
||||
* {"uuid": "d222f858-60fd-47fb-8731-dc9d5fc384c5", "score": 11, "status": 2, "percent_correct_answers": 0.25, "testing_date": "2022-04-03 09:23:45", "questionnaire_title": "Тест 2"},
|
||||
* {"uuid": "gcjs77d9-vtyd-02jh-9467-dc8fbb6s6jdb", "score": 20, "status": 2, "percent_correct_answers": 0.85, "testing_date": "2022-03-17 11:14:22", "questionnaire_title": "Тест 1"},
|
||||
* },
|
||||
* @OA\Items(
|
||||
* type="object",
|
||||
* @OA\Property(
|
||||
* property="uuid",
|
||||
* type="string",
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="score",
|
||||
* type="integer",
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="status",
|
||||
* type="integer",
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="percent_correct_answers",
|
||||
* type="float",
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="testing_date",
|
||||
* type="string",
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="questionnaire_title",
|
||||
* type="string",
|
||||
* ),
|
||||
* ),
|
||||
*)
|
||||
*
|
||||
*/
|
||||
class UserQuestionnaire extends \common\models\UserQuestionnaire
|
||||
{
|
||||
|
||||
}
|
102
frontend/modules/api/models/UserResponse.php
Normal file
102
frontend/modules/api/models/UserResponse.php
Normal file
@ -0,0 +1,102 @@
|
||||
<?php
|
||||
|
||||
namespace frontend\modules\api\models;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @OA\Schema(
|
||||
* schema="UserResponse",
|
||||
* @OA\Property(
|
||||
* property="user_id",
|
||||
* type="int",
|
||||
* example=1,
|
||||
* description="Идентификатор пользователя"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="question_id",
|
||||
* type="int",
|
||||
* example="7",
|
||||
* description="Идентификатор вопроса"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="response_body",
|
||||
* type="string",
|
||||
* example="Ответ",
|
||||
* description="Ответ пользователя"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="user_questionnaire_uuid",
|
||||
* type="string",
|
||||
* example="d222f858-60fd-47fb-8731-dc9d5fc384c5",
|
||||
* description="UUID анкеты назначенной пользователю"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="created_at",
|
||||
* type="string",
|
||||
* example="2021-10-20 13:06:12",
|
||||
* description="Дата создания"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="updated_at",
|
||||
* type="string",
|
||||
* example="2022-11-20 10:35:12",
|
||||
* description="Дата обновления"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="id",
|
||||
* type="integer",
|
||||
* example="5",
|
||||
* description="ID ответа"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="answer_flag",
|
||||
* type="bool",
|
||||
* example="0",
|
||||
* description="Флаг ответа"
|
||||
* ),
|
||||
*)
|
||||
*
|
||||
*
|
||||
* @OA\Schema(
|
||||
* schema="UserResponseExample",
|
||||
* type="array",
|
||||
* @OA\Items(
|
||||
* type="object",
|
||||
* ref="#/components/schemas/UserResponse",
|
||||
* ),
|
||||
* )
|
||||
*
|
||||
* @OA\Schema(
|
||||
* schema="UserResponseExampleArr",
|
||||
* type="array",
|
||||
* example={
|
||||
* {"user_id": 23, "question_id": 22, "response_body": "Ответ 1", "user_questionnaire_uuid": "d222f858-60fd-47fb-8731-dc9d5fc384c5",},
|
||||
* {"user_id": 16, "question_id": 3, "response_body": "Ответ 22", "user_questionnaire_uuid": "d222f858-60fd-47fb-8731-dc9d5fc384c5",},
|
||||
* },
|
||||
* @OA\Items(
|
||||
* type="object",
|
||||
* @OA\Property(
|
||||
* property="user_id",
|
||||
* type="integer",
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="question_id",
|
||||
* type="integer",
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="response_body",
|
||||
* type="string",
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="user_questionnaire_uuid",
|
||||
* type="string",
|
||||
* ),
|
||||
* ),
|
||||
*)
|
||||
*
|
||||
*/
|
||||
class UserResponse extends \common\models\UserResponse
|
||||
{
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user