add resume update method
This commit is contained in:
@ -2,11 +2,26 @@
|
||||
|
||||
namespace frontend\modules\api\controllers;
|
||||
|
||||
use frontend\modules\api\models\resume\forms\ChangeResumeForm;
|
||||
use frontend\modules\api\models\resume\Resume;
|
||||
use frontend\modules\api\services\ResumeService;
|
||||
use Yii;
|
||||
use yii\web\BadRequestHttpException;
|
||||
|
||||
class ResumeController extends ApiController
|
||||
{
|
||||
public ResumeService $resumeService;
|
||||
|
||||
public function __construct(
|
||||
$id,
|
||||
$module,
|
||||
ResumeService $resumeService,
|
||||
$config = []
|
||||
)
|
||||
{
|
||||
$this->resumeService = $resumeService;
|
||||
parent::__construct($id, $module, $config);
|
||||
}
|
||||
|
||||
/**
|
||||
* @OA\Get(path="/resume",
|
||||
@ -42,4 +57,87 @@ class ResumeController extends ApiController
|
||||
{
|
||||
return Resume::findOne($userId ?? Yii::$app->user->identity->id);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @OA\Put(path="/resume/edit-skills",
|
||||
* summary="Изменить скилы",
|
||||
* description="Метод полностью удалит старые скилы и используя переданые id скилов запишет новые",
|
||||
* security={
|
||||
* {"bearerAuth": {}}
|
||||
* },
|
||||
* tags={"Resume"},
|
||||
*
|
||||
* @OA\RequestBody(
|
||||
* @OA\MediaType(
|
||||
* mediaType="json",
|
||||
* @OA\Schema(
|
||||
* required={"UserCard"},
|
||||
* @OA\Property(
|
||||
* property="UserCard",
|
||||
* type="object",
|
||||
* @OA\Property(
|
||||
* property="skill",
|
||||
* type="array",
|
||||
* @OA\Items(
|
||||
* type="integer",
|
||||
* example={1,2,3,4}
|
||||
* ),
|
||||
* ),
|
||||
* ),
|
||||
* ),
|
||||
* ),
|
||||
* ),
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="Возвращает сообщение об успехе",
|
||||
* ),
|
||||
* )
|
||||
* )
|
||||
*
|
||||
* @return array|ChangeResumeForm
|
||||
* @throws BadRequestHttpException
|
||||
*/
|
||||
public function actionEditSkills()
|
||||
{
|
||||
return $this->resumeService->editSkills(Yii::$app->request->post(), Yii::$app->user->identity->getId());
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @OA\Put(path="/resume/edit-text",
|
||||
* summary="Изменить резюме",
|
||||
* description="Метод для изменения текста резюме",
|
||||
* security={
|
||||
* {"bearerAuth": {}}
|
||||
* },
|
||||
* tags={"Resume"},
|
||||
*
|
||||
* @OA\RequestBody(
|
||||
* @OA\MediaType(
|
||||
* mediaType="application/x-www-form-urlencoded",
|
||||
* @OA\Schema(
|
||||
* required={"resume"},
|
||||
* @OA\Property(
|
||||
* property="resume",
|
||||
* type="string",
|
||||
* description="Текст резюме",
|
||||
* ),
|
||||
* ),
|
||||
* ),
|
||||
* ),
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="Возвращает сообщение об успехе",
|
||||
* ),
|
||||
* )
|
||||
* )
|
||||
*
|
||||
* @return array|ChangeResumeForm
|
||||
* @throws BadRequestHttpException
|
||||
*/
|
||||
public function actionEditText(): ChangeResumeForm|array
|
||||
{
|
||||
return $this->resumeService->editText(Yii::$app->request->post(), Yii::$app->user->identity->getId());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user