added get-points-number, get-question-number methods, update status in UserQuestionnaire, some refactoring
This commit is contained in:
24
frontend/modules/api/controllers/UserCardController.php
Normal file
24
frontend/modules/api/controllers/UserCardController.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace frontend\modules\api\controllers;
|
||||
|
||||
use common\services\UserCardService;
|
||||
use yii\web\ServerErrorHttpException;
|
||||
|
||||
class UserCardController extends ApiController
|
||||
{
|
||||
public function verbs(): array
|
||||
{
|
||||
return [
|
||||
'get-user-card' => ['get'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws ServerErrorHttpException
|
||||
*/
|
||||
public function actionGetUserCard($user_id): array
|
||||
{
|
||||
return UserCardService::getUserCard($user_id);
|
||||
}
|
||||
}
|
@ -43,4 +43,28 @@ class UserQuestionnaireController extends ApiController
|
||||
}
|
||||
return $userQuestionnaireModel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws ServerErrorHttpException
|
||||
*/
|
||||
public function actionGetPointsNumber($user_questionnaire_uuid)
|
||||
{
|
||||
$questionPointsNumber = UserQuestionnaireService::getPointsNumber($user_questionnaire_uuid);
|
||||
if (empty($questionPointsNumber)) {
|
||||
throw new ServerErrorHttpException(json_encode('Question points not found!'));
|
||||
}
|
||||
return $questionPointsNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws ServerErrorHttpException
|
||||
*/
|
||||
public function actionGetQuestionNumber($user_questionnaire_uuid)
|
||||
{
|
||||
$questionNumber = UserQuestionnaireService::getQuestionNumber($user_questionnaire_uuid);
|
||||
if (empty($questionNumber)) {
|
||||
throw new ServerErrorHttpException(json_encode('Question number not found!'));
|
||||
}
|
||||
return $questionNumber;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user