This commit is contained in:
Kavalar 2023-04-12 13:14:37 +03:00
parent c65b7d10cc
commit 8bc601aa6a
43 changed files with 3005 additions and 795 deletions

View File

@ -80,6 +80,12 @@ return [
'document' => [ 'document' => [
'class' => 'backend\modules\document\Document', 'class' => 'backend\modules\document\Document',
], ],
'request' => [
'class' => 'backend\modules\request\Request',
],
'knowledgelevel' => [
'class' => 'backend\modules\knowledgelevel\KnowledgeLevel',
],
], ],
'components' => [ 'components' => [
'request' => [ 'request' => [

View File

@ -51,10 +51,13 @@ class UserCardSearch extends UserCard
->where(['id_user' => Yii::$app->user->id]) ->where(['id_user' => Yii::$app->user->id])
->one(); ->one();
$employeeIdList = ManagerEmployee::find() $employeeIdList = false;
->where(['manager_id' => $userCard->manager->id]) if (isset($userCard->manager)) {
->select('user_card_id') $employeeIdList = ManagerEmployee::find()
->column(); ->where(['manager_id' => $userCard->manager->id])
->select('user_card_id')
->column();
}
$query = UserCard::find()->where(['in', 'user_card.id', $employeeIdList]); $query = UserCard::find()->where(['in', 'user_card.id', $employeeIdList]);
} }

View File

@ -0,0 +1,24 @@
<?php
namespace backend\modules\knowledgelevel;
/**
* knowledgelevel module definition class
*/
class KnowledgeLevel extends \yii\base\Module
{
/**
* {@inheritdoc}
*/
public $controllerNamespace = 'backend\modules\knowledgelevel\controllers';
/**
* {@inheritdoc}
*/
public function init()
{
parent::init();
// custom initialization code goes here
}
}

View File

@ -0,0 +1,20 @@
<?php
namespace backend\modules\knowledgelevel\controllers;
use yii\web\Controller;
/**
* Default controller for the `knowledgelevel` module
*/
class DefaultController extends Controller
{
/**
* Renders the index view for the module
* @return string
*/
public function actionIndex()
{
return $this->render('index');
}
}

View File

@ -0,0 +1,127 @@
<?php
namespace backend\modules\knowledgelevel\controllers;
use Yii;
use backend\modules\knowledgelevel\models\KnowledgeLevel;
use backend\modules\knowledgelevel\models\KnowledgeLevelSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
/**
* KnowledgeLevelController implements the CRUD actions for KnowledgeLevel model.
*/
class KnowledgeLevelController extends Controller
{
/**
* {@inheritdoc}
*/
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['POST'],
],
],
];
}
/**
* Lists all KnowledgeLevel models.
* @return mixed
*/
public function actionIndex()
{
$searchModel = new KnowledgeLevelSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
/**
* Displays a single KnowledgeLevel model.
* @param integer $id
* @return mixed
* @throws NotFoundHttpException if the model cannot be found
*/
public function actionView($id)
{
return $this->render('view', [
'model' => $this->findModel($id),
]);
}
/**
* Creates a new KnowledgeLevel model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
{
$model = new KnowledgeLevel();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id]);
}
return $this->render('create', [
'model' => $model,
]);
}
/**
* Updates an existing KnowledgeLevel model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id
* @return mixed
* @throws NotFoundHttpException if the model cannot be found
*/
public function actionUpdate($id)
{
$model = $this->findModel($id);
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id]);
}
return $this->render('update', [
'model' => $model,
]);
}
/**
* Deletes an existing KnowledgeLevel model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
* @throws NotFoundHttpException if the model cannot be found
*/
public function actionDelete($id)
{
$this->findModel($id)->delete();
return $this->redirect(['index']);
}
/**
* Finds the KnowledgeLevel model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return KnowledgeLevel the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
{
if (($model = KnowledgeLevel::findOne($id)) !== null) {
return $model;
}
throw new NotFoundHttpException('The requested page does not exist.');
}
}

View File

@ -0,0 +1,8 @@
<?php
namespace backend\modules\knowledgelevel\models;
class KnowledgeLevel extends \common\models\KnowledgeLevel
{
}

View File

@ -0,0 +1,69 @@
<?php
namespace backend\modules\knowledgelevel\models;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use backend\modules\knowledgelevel\models\KnowledgeLevel;
/**
* KnowledgeLevelSearch represents the model behind the search form of `backend\modules\knowledgelevel\models\KnowledgeLevel`.
*/
class KnowledgeLevelSearch extends KnowledgeLevel
{
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['id', 'status'], 'integer'],
[['title'], 'safe'],
];
}
/**
* {@inheritdoc}
*/
public function scenarios()
{
// bypass scenarios() implementation in the parent class
return Model::scenarios();
}
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = KnowledgeLevel::find();
// add conditions that should always apply here
$dataProvider = new ActiveDataProvider([
'query' => $query,
]);
$this->load($params);
if (!$this->validate()) {
// uncomment the following line if you do not want to return any records when validation fails
// $query->where('0=1');
return $dataProvider;
}
// grid filtering conditions
$query->andFilterWhere([
'id' => $this->id,
'status' => $this->status,
]);
$query->andFilterWhere(['like', 'title', $this->title]);
return $dataProvider;
}
}

View File

@ -0,0 +1,12 @@
<div class="knowledgelevel-default-index">
<h1><?= $this->context->action->uniqueId ?></h1>
<p>
This is the view content for action "<?= $this->context->action->id ?>".
The action belongs to the controller "<?= get_class($this->context) ?>"
in the "<?= $this->context->module->id ?>" module.
</p>
<p>
You may customize this page by editing the following file:<br>
<code><?= __FILE__ ?></code>
</p>
</div>

View File

@ -0,0 +1,25 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\modules\knowledgelevel\models\KnowledgeLevel */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="knowledge-level-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'status')->dropDownList(\common\models\KnowledgeLevel::getStatus()) ?>
<div class="form-group">
<?= Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,31 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\modules\knowledgelevel\models\KnowledgeLevelSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="knowledge-level-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<?= $form->field($model, 'id') ?>
<?= $form->field($model, 'title') ?>
<?= $form->field($model, 'status') ?>
<div class="form-group">
<?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
<?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,18 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model backend\modules\knowledgelevel\models\KnowledgeLevel */
$this->title = 'Добавить уровень знаний';
$this->params['breadcrumbs'][] = ['label' => 'Уровень знаний', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="knowledge-level-create">
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,39 @@
<?php
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel backend\modules\knowledgelevel\models\KnowledgeLevelSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Уровень знаний';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="knowledge-level-index">
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
<p>
<?= Html::a('Добавить', ['create'], ['class' => 'btn btn-success']) ?>
</p>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
// 'id',
'title',
[
'attribute' => 'status',
'value' => function($model){
return \common\models\KnowledgeLevel::getStatus()[$model->status];
}
],
['class' => 'yii\grid\ActionColumn'],
],
]); ?>
</div>

View File

@ -0,0 +1,19 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model backend\modules\knowledgelevel\models\KnowledgeLevel */
$this->title = 'Редактировать: ' . $model->title;
$this->params['breadcrumbs'][] = ['label' => 'Уровень знаний', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->title, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = 'Редактировать';
?>
<div class="knowledge-level-update">
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,42 @@
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model backend\modules\knowledgelevel\models\KnowledgeLevel */
$this->title = $model->title;
$this->params['breadcrumbs'][] = ['label' => 'Knowledge Levels', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
\yii\web\YiiAsset::register($this);
?>
<div class="knowledge-level-view">
<p>
<?= Html::a('Редактировать', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
<?= Html::a('Список', ['index'], ['class' => 'btn btn-primary']) ?>
<?= Html::a('Удалить', ['delete', 'id' => $model->id], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => 'Are you sure you want to delete this item?',
'method' => 'post',
],
]) ?>
</p>
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id',
'title',
[
'attribute' => 'status',
'value' => function($model){
return \common\models\KnowledgeLevel::getStatus()[$model->status];
}
],
],
]) ?>
</div>

View File

@ -0,0 +1,24 @@
<?php
namespace backend\modules\request;
/**
* request module definition class
*/
class Request extends \yii\base\Module
{
/**
* {@inheritdoc}
*/
public $controllerNamespace = 'backend\modules\request\controllers';
/**
* {@inheritdoc}
*/
public function init()
{
parent::init();
// custom initialization code goes here
}
}

View File

@ -0,0 +1,20 @@
<?php
namespace backend\modules\request\controllers;
use yii\web\Controller;
/**
* Default controller for the `request` module
*/
class DefaultController extends Controller
{
/**
* Renders the index view for the module
* @return string
*/
public function actionIndex()
{
return $this->render('index');
}
}

View File

@ -0,0 +1,147 @@
<?php
namespace backend\modules\request\controllers;
use common\classes\Debug;
use common\services\RequestService;
use Yii;
use backend\modules\request\models\Request;
use backend\modules\request\models\RequestSearch;
use yii\data\ArrayDataProvider;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
/**
* RequestController implements the CRUD actions for Request model.
*/
class RequestController extends Controller
{
/**
* {@inheritdoc}
*/
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['POST'],
],
],
];
}
/**
* Lists all Request models.
* @return mixed
*/
public function actionIndex()
{
$searchModel = new RequestSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
/**
* Displays a single Request model.
* @param integer $id
* @return mixed
* @throws NotFoundHttpException if the model cannot be found
*/
public function actionView(int $id)
{
$res = RequestService::run($id)->getById();
$search = RequestService::run($id)->search(3);
$searchDataProvider = new ArrayDataProvider([
'allModels' => $search,
'pagination' => [
'pageSize' => 10,
],
'sort' => [
'attributes' => ['id', 'fio'],
],
]);
return $this->render('view', [
'model' => $res,
'searchDataProvider' => $searchDataProvider,
]);
}
/**
* Creates a new Request model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
{
$req = RequestService::run()->load(Yii::$app->request->post());
if ($req->isLoad) {
$req->save();
return $this->redirect(['view', 'id' => $req->model->id]);
}
return $this->render('create', [
'model' => $req->model,
]);
}
/**
* Updates an existing Request model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id
* @return mixed
* @throws NotFoundHttpException if the model cannot be found
*/
public function actionUpdate($id)
{
$req = RequestService::run($id)->load(Yii::$app->request->post());
if ($req->isLoad) {
$req->save();
return $this->redirect(['view', 'id' => $req->model->id]);
}
return $this->render('update', [
'model' => $req->model,
]);
}
/**
* Deletes an existing Request model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
* @throws NotFoundHttpException if the model cannot be found
*/
public function actionDelete($id)
{
$this->findModel($id)->delete();
return $this->redirect(['index']);
}
/**
* Finds the Request model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return Request the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
{
if (($model = Request::findOne($id)) !== null) {
return $model;
}
throw new NotFoundHttpException('The requested page does not exist.');
}
}

View File

@ -0,0 +1,8 @@
<?php
namespace backend\modules\request\models;
class Request extends \common\models\Request
{
}

View File

@ -0,0 +1,79 @@
<?php
namespace backend\modules\request\models;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use backend\modules\request\models\Request;
/**
* RequestSearch represents the model behind the search form of `backend\modules\request\models\Request`.
*/
class RequestSearch extends Request
{
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['id', 'user_id', 'position_id', 'knowledge_level_id', 'specialist_count', 'status'], 'integer'],
[['created_at', 'updated_at', 'title', 'skill_ids', 'descr'], 'safe'],
];
}
/**
* {@inheritdoc}
*/
public function scenarios()
{
// bypass scenarios() implementation in the parent class
return Model::scenarios();
}
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = Request::find();
// add conditions that should always apply here
$dataProvider = new ActiveDataProvider([
'query' => $query,
]);
$this->load($params);
if (!$this->validate()) {
// uncomment the following line if you do not want to return any records when validation fails
// $query->where('0=1');
return $dataProvider;
}
// grid filtering conditions
$query->andFilterWhere([
'id' => $this->id,
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
'user_id' => $this->user_id,
'position_id' => $this->position_id,
'knowledge_level_id' => $this->knowledge_level_id,
'specialist_count' => $this->specialist_count,
'status' => $this->status,
]);
$query->andFilterWhere(['like', 'title', $this->title])
->andFilterWhere(['like', 'skill_ids', $this->skill_ids])
->andFilterWhere(['like', 'descr', $this->descr]);
$query->orderBy('id DESC');
return $dataProvider;
}
}

View File

@ -0,0 +1,12 @@
<div class="request-default-index">
<h1><?= $this->context->action->uniqueId ?></h1>
<p>
This is the view content for action "<?= $this->context->action->id ?>".
The action belongs to the controller "<?= get_class($this->context) ?>"
in the "<?= $this->context->module->id ?>" module.
</p>
<p>
You may customize this page by editing the following file:<br>
<code><?= __FILE__ ?></code>
</p>
</div>

View File

@ -0,0 +1,63 @@
<?php
use kartik\select2\Select2;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\modules\request\models\Request */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="request-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'user_id')->widget(
Select2::class,
[
'data' => \common\models\UserCard::getListUserWithUserId(),
'options' => ['placeholder' => '...', 'class' => 'form-control'],
'pluginOptions' => [
'allowClear' => true
],
]
); ?>
<?= $form->field($model, 'position_id')->dropDownList(\common\models\Position::getList(), [
'prompt' => 'Выберите'
]) ?>
<?= $form->field($model, 'skill_ids')->widget(
Select2::class,
[
'data' => \yii\helpers\ArrayHelper::map(\common\models\Skill::find()->all(), 'id', 'name'),
'options' => ['placeholder' => '...', 'class' => 'form-control', 'multiple' => true],
'pluginOptions' => [
'allowClear' => true
],
]
)->label('Навыки'); ?>
<?= $form->field($model, 'knowledge_level_id')->dropDownList(
\common\models\UserCard::getLevelList(),
['prompt' => '...']
) ?>
<?= $form->field($model, 'descr')->textarea(['rows' => 6]) ?>
<?= $form->field($model, 'specialist_count')->textInput() ?>
<?= $form->field($model, 'status')->dropDownList(\common\models\Request::getStatus(), [
'prompt' => 'Выберите'
]) ?>
<div class="form-group">
<?= Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,47 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\modules\request\models\RequestSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="request-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<?= $form->field($model, 'id') ?>
<?= $form->field($model, 'created_at') ?>
<?= $form->field($model, 'updated_at') ?>
<?= $form->field($model, 'user_id') ?>
<?= $form->field($model, 'title') ?>
<?php // echo $form->field($model, 'position_id') ?>
<?php // echo $form->field($model, 'skill_ids') ?>
<?php // echo $form->field($model, 'knowledge_level_id') ?>
<?php // echo $form->field($model, 'descr') ?>
<?php // echo $form->field($model, 'specialist_count') ?>
<?php // echo $form->field($model, 'status') ?>
<div class="form-group">
<?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
<?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,18 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model backend\modules\request\models\Request */
$this->title = 'Добавить';
$this->params['breadcrumbs'][] = ['label' => 'Запросы', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="request-create">
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,62 @@
<?php
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel backend\modules\request\models\RequestSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Запросы';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="request-index">
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
<p>
<?= Html::a('Добавить запрос', ['create'], ['class' => 'btn btn-success']) ?>
</p>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
//'id',
'created_at',
//'updated_at',
[
'attribute' => 'user_id',
'value' => function(\common\models\Request $model){
return $model->user->userCard->fio ?? 'Не задано';
}
],
'title',
[
'attribute' => 'position_id',
'value' => function(\common\models\Request $model){
return $model->position->name ?? 'Не задано';
}
],
//'skill_ids',
[
'attribute' => 'knowledge_level_id',
'value' => function(\common\models\Request $model){
return \common\models\UserCard::getLevelList()[$model->knowledge_level_id];
}
],
//'descr:ntext',
'specialist_count',
[
'attribute' => 'status',
'value' => function(\common\models\Request $model){
return \common\models\KnowledgeLevel::getStatus()[$model->status];
}
],
['class' => 'yii\grid\ActionColumn'],
],
]); ?>
</div>

View File

@ -0,0 +1,19 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model backend\modules\request\models\Request */
$this->title = 'Редактировать запрос: ' . $model->title;
$this->params['breadcrumbs'][] = ['label' => 'Запросы', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->title, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = 'Ред.';
?>
<div class="request-update">
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,88 @@
<?php
use yii\grid\GridView;
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model backend\modules\request\models\Request */
/* @var $searchDataProvider \yii\data\ArrayDataProvider */
$this->title = $model->title;
$this->params['breadcrumbs'][] = ['label' => 'Requests', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
\yii\web\YiiAsset::register($this);
?>
<div class="request-view">
<p>
<?= Html::a('Редактировать', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
<?= Html::a('Список', ['index'], ['class' => 'btn btn-primary']) ?>
<?= Html::a('Удалить', ['delete', 'id' => $model->id], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => 'Are you sure you want to delete this item?',
'method' => 'post',
],
]) ?>
</p>
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id',
'created_at',
'updated_at',
[
'attribute' => 'user_id',
'value' => function (\common\models\Request $model) {
return $model->user->userCard->fio ?? 'Не задано';
}
],
'title',
[
'attribute' => 'position_id',
'value' => function (\common\models\Request $model) {
return $model->position->name ?? 'Не задано';
}
],
// 'skill_ids',
[
'attribute' => 'skill_ids',
'value' => function (\common\models\Request $model) {
$skillStr = '';
foreach ($model->skills as $skill) {
$skillStr .= $skill['name'] . ", ";
}
return $skillStr;
}
],
[
'attribute' => 'knowledge_level_id',
'value' => function (\common\models\Request $model) {
return \common\models\UserCard::getLevelList()[$model->knowledge_level_id];
}
],
'descr:ntext',
'specialist_count',
[
'attribute' => 'status',
'value' => function (\common\models\Request $model) {
return \common\models\Request::getStatus()[$model->status] ?? 'Не задано';
}
],
],
]) ?>
<h3>Подходящие кандидаты</h3>
<?= GridView::widget([
'dataProvider' => $searchDataProvider,
'columns' => [['class' => 'yii\grid\SerialColumn'],
'id',
'fio',
],
]); ?>
</div>

View File

@ -36,6 +36,7 @@
['label' => 'Шаблоны резюме', 'icon' => 'address-card ', 'url' => ['/card/resume-template'], 'active' => \Yii::$app->controller->id == 'resume-template', 'visible' => Yii::$app->user->can('card')], ['label' => 'Шаблоны резюме', 'icon' => 'address-card ', 'url' => ['/card/resume-template'], 'active' => \Yii::$app->controller->id == 'resume-template', 'visible' => Yii::$app->user->can('card')],
['label' => 'Шаблоны документов', 'icon' => 'file', 'url' => ['/document/document-template'], 'active' => \Yii::$app->controller->id == 'document-template', 'visible' => Yii::$app->user->can('document')], ['label' => 'Шаблоны документов', 'icon' => 'file', 'url' => ['/document/document-template'], 'active' => \Yii::$app->controller->id == 'document-template', 'visible' => Yii::$app->user->can('document')],
['label' => 'Поля документов', 'icon' => 'file-text', 'url' => ['/document/document-field'], 'active' => \Yii::$app->controller->id == 'document-field', 'visible' => Yii::$app->user->can('document')], ['label' => 'Поля документов', 'icon' => 'file-text', 'url' => ['/document/document-field'], 'active' => \Yii::$app->controller->id == 'document-field', 'visible' => Yii::$app->user->can('document')],
['label' => 'Уровень знаний', 'icon' => 'code', 'url' => ['/knowledgelevel/knowledge-level'], 'active' => \Yii::$app->controller->id == 'knowledge-level', 'visible' => Yii::$app->user->can('knowledgelevel/knowledge-level')],
[ [
'label' => 'Роли', 'icon' => 'users', 'url' => '#', 'label' => 'Роли', 'icon' => 'users', 'url' => '#',
'items' => [ 'items' => [
@ -59,6 +60,7 @@
], ],
'visible' => Yii::$app->user->can('employee') 'visible' => Yii::$app->user->can('employee')
], ],
['label' => 'Запросы', 'icon' => 'eye', 'url' => ['/request/request'], 'active' => \Yii::$app->controller->id == 'request', 'visible' => Yii::$app->user->can('request/request')],
['label' => 'Документы', 'icon' => 'archive', 'url' => ['/document/document'], 'active' => \Yii::$app->controller->id == 'document', 'visible' => Yii::$app->user->can('document')], ['label' => 'Документы', 'icon' => 'archive', 'url' => ['/document/document'], 'active' => \Yii::$app->controller->id == 'document', 'visible' => Yii::$app->user->can('document')],
[ [
'label' => 'Проекты', 'icon' => 'cubes', 'url' => ['#'], 'label' => 'Проекты', 'icon' => 'cubes', 'url' => ['#'],

View File

@ -0,0 +1,63 @@
<?php
namespace common\models;
use Yii;
/**
* This is the model class for table "knowledge_level".
*
* @property int $id
* @property string $title
* @property int $status
*/
class KnowledgeLevel extends \yii\db\ActiveRecord
{
const STATUS_ACTIVE = 1;
const STATUS_DISABLE = 0;
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'knowledge_level';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['title'], 'required'],
[['status'], 'integer'],
[['title'], 'string', 'max' => 255],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'title' => 'Название',
'status' => 'Статус',
];
}
/**
* @return string[]
*/
public static function getStatus(): array
{
return [
self::STATUS_ACTIVE => 'Активен',
self::STATUS_DISABLE => 'Выключен'
];
}
}

View File

@ -3,6 +3,7 @@
namespace common\models; namespace common\models;
use Yii; use Yii;
use yii\helpers\ArrayHelper;
/** /**
* This is the model class for table "position". * This is the model class for table "position".
@ -46,4 +47,9 @@ class Position extends \yii\db\ActiveRecord
{ {
return $this->hasMany(UserCard::class, ['position_id' => 'id']); return $this->hasMany(UserCard::class, ['position_id' => 'id']);
} }
public static function getList()
{
return ArrayHelper::map(self::find()->all(), 'id', 'name');
}
} }

159
common/models/Request.php Normal file
View File

@ -0,0 +1,159 @@
<?php
namespace common\models;
use common\classes\Debug;
use common\services\RequestService;
use Yii;
use yii\behaviors\TimestampBehavior;
use yii\db\ActiveQuery;
use yii\db\Expression;
/**
* This is the model class for table "request".
*
* @property int $id
* @property string $created_at
* @property string $updated_at
* @property int $user_id
* @property string $title
* @property int $position_id
* @property string $skill_ids
* @property int $knowledge_level_id
* @property string $descr
* @property int $specialist_count
* @property int $status
* @property int $result_count
*/
class Request extends \yii\db\ActiveRecord
{
const STATUS_ACTIVE = 1;
const STATUS_DISABLE = 0;
public int $result_count = 0;
public array $skills = [];
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'request';
}
public function behaviors()
{
return [
[
'class' => TimestampBehavior::class,
'createdAtAttribute' => 'created_at',
'updatedAtAttribute' => 'updated_at',
'value' => new Expression('NOW()'),
],
];
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['created_at', 'updated_at', 'skills'], 'safe'],
[['user_id', 'title', 'position_id', 'status'], 'required'],
[['user_id', 'position_id', 'knowledge_level_id', 'specialist_count', 'status'], 'integer'],
[['descr'], 'string'],
[['title'], 'string', 'max' => 255],
[['skill_ids'], 'safe']
];
}
public function fields()
{
$fields = parent::fields();
$additionalFields = [
'position',
'skills',
'result_count',
'level' => function (Request $model) {
return UserCard::getLevelList()[$model->knowledge_level_id];
},
];
return array_merge($fields, $additionalFields);
}
/**
* {@inheritdoc}
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'created_at' => 'Дата создания',
'updated_at' => 'Дата редактирования',
'user_id' => 'Пользователь',
'title' => 'Заголовок',
'position_id' => 'Специализация',
'skill_ids' => 'Навыки',
'knowledge_level_id' => 'Уровень',
'descr' => 'Описание',
'specialist_count' => 'Кол-во специалистов',
'status' => 'Статус',
];
}
public function beforeSave($insert)
{
if (parent::beforeSave($insert)) {
if ($this->skill_ids && is_array($this->skill_ids)) {
$this->skill_ids = implode(",", $this->skill_ids);
}
return true;
}
return false;
}
public function afterFind()
{
parent::afterFind();
if ($this->skill_ids != "") {
$this->skill_ids = explode(",", $this->skill_ids);
}
else {
$this->skill_ids = [];
}
$this->skills = Skill::find()->where(['id' => $this->skill_ids])->asArray()->all();
}
/**
* @return \yii\db\ActiveQuery
*/
public function getPosition(): \yii\db\ActiveQuery
{
return $this->hasOne(Position::class, ['id' => 'position_id']);
}
/**
* @return \yii\db\ActiveQuery
*/
public function getUser(): \yii\db\ActiveQuery
{
return $this->hasOne(User::class, ['id' => 'user_id']);
}
/**
* @return string[]
*/
public static function getStatus(): array
{
return [
self::STATUS_ACTIVE => 'Активен',
self::STATUS_DISABLE => 'Выключен'
];
}
}

View File

@ -261,6 +261,17 @@ class UserCard extends \yii\db\ActiveRecord
return ArrayHelper::map(self::find()->all(), 'id', 'fio'); return ArrayHelper::map(self::find()->all(), 'id', 'fio');
} }
public static function getListUserWithUserId($statusId = null)
{
$list = self::find();
if ($statusId){
$list->where(['status' => $statusId]);
}
return ArrayHelper::map($list->all(), 'id_user', 'fio');
}
public function getManager() public function getManager()
{ {
return $this->hasOne(Manager::class, ['user_card_id' => 'id']); return $this->hasOne(Manager::class, ['user_card_id' => 'id']);

View File

@ -0,0 +1,336 @@
<?php
namespace common\services;
use common\classes\Debug;
use common\models\CardSkill;
use common\models\Request;
use common\models\UserCard;
use yii\helpers\ArrayHelper;
class RequestService
{
/**
* @var int
*/
public int $id;
/**
* @var Request
*/
public Request $model;
/**
* @var array
*/
public array $errors = [];
/**
* @var bool
*/
public bool $isSave = false;
/**
* @var bool
*/
public bool $isLoad = false;
/**
* @var array
*/
private array $excludePool = [];
/**
* @var bool
*/
private bool $skillsFullEntry = true;
/**
* @var bool
*/
private bool $cardAsArray = true;
/**
* @var bool
*/
private bool $checkCardLevel = true;
/**
* @var bool
*/
private bool $useCardExcludePool = false;
/**
* @var bool
*/
private bool $checkCardPosition = true;
/**
* @var bool
*/
private bool $returnCount = false;
public function __construct(int $id = null)
{
if ($id) {
$this->id = $id;
$this->model = Request::findOne($id);
} else {
$this->model = new Request();
}
}
/**
* @param array $params
* @return RequestService
*/
public function save(array $params = []): RequestService
{
//$this->model->load($params);
if ($this->model->validate()) {
$this->isSave = $this->model->save();
$this->id = $this->model->id;
} else {
$this->errors = $this->model->errors;
}
return $this;
}
/**
* @param array $params
* @return RequestService
*/
public function load(array $params, $formName = "Request"): RequestService
{
if ($this->model->load($params, $formName)) {
$this->isLoad = true;
}
return $this;
}
/**
* @return Request|null
*/
public function getModel(): ?Request
{
return $this->model;
}
/**
* @return bool
*/
public function isFind(): bool
{
if ($this->model->id) {
return true;
}
return false;
}
/**
* @param $id
* @return array|Request|null
*/
public function getById()
{
return $this->model->find()->where(['id' => $this->id])->one();
}
/**
* @param $user_id
* @return array|Request|\yii\db\ActiveRecord[]
*/
public function getByUserId($user_id)
{
return $this->model->find()->where(['user_id' => $user_id])->all();
}
/**
* @param $userId
* @return $this
*/
public function setUserId($userId): RequestService
{
$this->model->user_id = $userId;
return $this;
}
/**
* @return array|int
*/
public function _search()
{
$model = $this->getById($this->id);
$subQ = false;
if (!empty($model->skill_ids)) {
$subQ = CardSkill::find()->select('card_skill.card_id')
->where(['skill_id' => $model->skill_ids])
->groupBy('card_id HAVING COUNT(DISTINCT skill_id) = :count')
->addParams([':count' => count($model->skill_ids)]);
}
$q = UserCard::find()->select('user_card.id, fio, user_card.position_id, card_skill.skill_id')
->leftJoin('card_skill', 'card_skill.card_id = user_card.id')
->where(['deleted_at' => null])
->andWhere(['status' => [4, 12]])
->andWhere(['not', ['position_id' => null]]);
if ($this->checkCardPosition) {
$q->andWhere(['position_id' => $model->position_id]);
}
if ($this->checkCardLevel) {
$q->andWhere(['level' => $model->knowledge_level_id]);
}
if ($this->skillsFullEntry && $subQ) {
$q->andWhere(['user_card.id' => $subQ]);
}
if ($model->skill_ids) {
$q->andWhere(['card_skill.skill_id' => $model->skill_ids]);
}
if ($this->useCardExcludePool) {
$q->andWhere(['not', ['user_card.id' => $this->excludePool]]);
}
$q->groupBy('user_card.id');
if ($this->cardAsArray) {
$q->asArray();
}
if ($this->returnCount) {
return $q->count();
} else {
$cards = $q->all();
}
if (is_array($cards)) {
$this->excludePool = array_merge($this->excludePool, ArrayHelper::getColumn($cards, 'id'));
}
return $cards;
}
/**
* @param int $searchDepth
* @return array|int
*/
public function search(int $searchDepth = 0)
{
$cards = $this->_search();
$res = [];
if ($searchDepth === 1) {
$res = $this->checkLevel(false)->useExcludePool()->_search();
}
if ($searchDepth === 2) {
$res = $this->checkLevel(false)->checkPosition(false)->useExcludePool()->_search();
}
if ($searchDepth === 3) {
$res = $this->checkLevel(false)->checkPosition(false)->setSkillsFullEntry(false)->useExcludePool()->_search();
}
if ($this->returnCount) {
if (is_array($res)) {
return $cards;
}
return $res;
}
return array_merge($cards, $res);
}
/**
* @param bool $value
* @return $this
*/
public function setSkillsFullEntry(bool $value): RequestService
{
$this->skillsFullEntry = $value;
return $this;
}
/**
* @param bool $value
* @return $this
*/
public function asArray(bool $value = true): RequestService
{
$this->cardAsArray = $value;
return $this;
}
/**
* @param bool $value
* @return $this
*/
public function checkLevel(bool $value = true): RequestService
{
$this->checkCardLevel = $value;
return $this;
}
/**
* @param bool $value
* @return $this
*/
public function checkPosition(bool $value = true): RequestService
{
$this->checkCardPosition = $value;
return $this;
}
/**
* @param bool $value
* @return $this
*/
public function useExcludePool(bool $value = true): RequestService
{
$this->useCardExcludePool = $value;
return $this;
}
/**
* @param bool $value
* @return $this
*/
public function count(bool $value = true): RequestService
{
$this->returnCount = $value;
return $this;
}
public static function q()
{
}
/**
* @param int|null $id
* @return RequestService
*/
public static function run(int $id = null): RequestService
{
return new self($id);
}
}

View File

@ -14,7 +14,7 @@
}, },
"minimum-stability": "stable", "minimum-stability": "stable",
"require": { "require": {
"php": ">=7.1.0", "php": ">=7.4.0",
"yiisoft/yii2": "~2.0.6", "yiisoft/yii2": "~2.0.6",
"yiisoft/yii2-bootstrap": "~2.0.0", "yiisoft/yii2-bootstrap": "~2.0.0",
"yiisoft/yii2-swiftmailer": "~2.0.0 || ~2.1.0", "yiisoft/yii2-swiftmailer": "~2.0.0 || ~2.1.0",
@ -36,7 +36,8 @@
"kartik-v/yii2-widget-fileinput": "@dev", "kartik-v/yii2-widget-fileinput": "@dev",
"kartik-v/yii2-mpdf": "dev-master", "kartik-v/yii2-mpdf": "dev-master",
"mihaildev/yii2-ckeditor": "*", "mihaildev/yii2-ckeditor": "*",
"developeruz/yii2-db-rbac": "*" "developeruz/yii2-db-rbac": "*",
"zircote/swagger-php": "^4.7"
}, },
"require-dev": { "require-dev": {
"yiisoft/yii2-debug": "~2.0.0", "yiisoft/yii2-debug": "~2.0.0",

1655
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,26 @@
<?php
namespace console\controllers;
use OpenApi\Annotations\OpenApi;
use yii\console\Controller;
use Yii;
use yii\console\ExitCode;
use yii\helpers\Console;
class SwaggerController extends Controller
{
public function actionGo()
{
$openApi = \OpenApi\Generator::scan([Yii::getAlias("@frontend/modules/api")]);
$file = Yii::getAlias('@frontend/web/api-doc/dist/swagger.yaml');
$handle = fopen($file, 'wb');
fwrite($handle, $openApi->toYaml());
fclose($handle);
echo $this->ansiFormat('Created \n", Console::FG_BLUE');
return ExitCode::OK;
}
}

View File

@ -0,0 +1,37 @@
<?php
use yii\db\Migration;
/**
* Handles the creation of table `{{%request}}`.
*/
class m230329_211037_create_request_table extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->createTable('{{%request}}', [
'id' => $this->primaryKey(),
'created_at' => $this->dateTime(),
'updated_at' => $this->dateTime(),
'user_id' => $this->integer(11)->notNull(),
'title' => $this->string(255)->notNull(),
'position_id' => $this->integer(11),
'skill_ids' => $this->string(255),
'knowledge_level_id' => $this->integer(11),
'descr' => $this->text(),
'specialist_count' => $this->integer(2),
'status' => $this->integer(1)->defaultValue(0)
]);
}
/**
* {@inheritdoc}
*/
public function safeDown()
{
$this->dropTable('{{%request}}');
}
}

View File

@ -0,0 +1,29 @@
<?php
use yii\db\Migration;
/**
* Handles the creation of table `{{%knowledge_level}}`.
*/
class m230329_212545_create_knowledge_level_table extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->createTable('{{%knowledge_level}}', [
'id' => $this->primaryKey(),
'title' => $this->string(255)->notNull(),
'status' => $this->integer(1)
]);
}
/**
* {@inheritdoc}
*/
public function safeDown()
{
$this->dropTable('{{%knowledge_level}}');
}
}

View File

@ -9,6 +9,36 @@ use yii\filters\ContentNegotiator;
use yii\rest\Controller; use yii\rest\Controller;
use yii\web\Response; use yii\web\Response;
/**
* @OA\Info(
* version="1.0.0",
* title="Документация Гильдия",
* description="Документация для работы с API",
*
* ),
* @OA\PathItem(
* path="/api"
* ),
* @OA\Server(
* url="https://itguild.info/api",
* description="Основной сервер",
* ),
*
* @OA\Server(
* url="https://guild.loc/api",
* description="Локальный сервер",
* ),
*
* @OA\SecurityScheme(
* securityScheme="bearerAuth",
* in="header",
* name="Authorization",
* type="http",
* scheme="bearer",
* bearerFormat="JWT",
* ),
*/
class ApiController extends Controller class ApiController extends Controller
{ {

View File

@ -0,0 +1,226 @@
<?php
namespace frontend\modules\api\controllers;
use common\classes\Debug;
use common\models\Request;
use common\services\RequestService;
use yii\web\BadRequestHttpException;
use yii\web\NotFoundHttpException;
class RequestController extends ApiController
{
public function verbs(): array
{
return [
'get-request' => ['get'],
'get-request-list' => ['get'],
'create-request' => ['post'],
// 'update-task' => ['put', 'patch'],
];
}
/**
* @OA\Get(path="/request/get-request",
* summary="Получить запрос",
* description="Получения запроса по идентификатору",
* security={
* {"bearerAuth": {}}
* },
* tags={"Requests"},
* @OA\Parameter(
* name="request_id",
* in="query",
* required=true,
* @OA\Schema(
* type="integer",
* )
* ),
* @OA\Parameter(
* name="search_depth",
* in="query",
* required=false,
* @OA\Schema(
* type="integer",
* default=3
* )
* ),
* @OA\Response(
* response=200,
* description="Возвращает объект Запроса",
* @OA\MediaType(
* mediaType="application/json",
* @OA\Schema(ref="#/components/schemas/Request"),
* ),
*
* ),
* )
*/
public function actionGetRequest(int $request_id, int $search_depth = 3): Request
{
if (empty($request_id) or !is_numeric($request_id)) {
throw new NotFoundHttpException('Incorrect request ID');
}
$request = RequestService::run($request_id)->getById();
if (empty($request)) {
throw new NotFoundHttpException('The request does not exist');
}
$request->result_count = RequestService::run($request_id)->count()->search($search_depth);
return $request;
}
/**
*
* @OA\Get(path="/request/get-request-list",
* summary="Создать запрос",
* description="Метод для создания запроса, если параметр user_id не передан, то запрос создается от имени текущего пользователя.",
* security={
* {"bearerAuth": {}}
* },
* tags={"Requests"},
* @OA\Parameter(
* name="user_id",
* in="query",
* required=false,
* @OA\Schema(
* type="integer",
* default=null
* )
* ),
* @OA\Parameter(
* name="search_depth",
* in="query",
* required=false,
* @OA\Schema(
* type="integer",
* default=3
* )
* ),
* @OA\Response(
* response=200,
* description="Возвращает объект Запроса",
* @OA\MediaType(
* mediaType="application/json",
* @OA\Schema(ref="#/components/schemas/RequestsExample"),
* ),
* ),
* )
*
* @param int|null $user_id
* @return array|\yii\db\ActiveRecord[]
*/
public function actionGetList(int $user_id = null, int $search_depth = 3): array
{
if (!$user_id) {
$user_id = \Yii::$app->user->id;
}
$requests = RequestService::run()->getByUserId($user_id);
foreach ($requests as $request) {
$request->result_count = RequestService::run($request->id)->count()->search($search_depth);
}
return $requests;
}
/**
*
* @OA\Post(path="/request/create-request",
* summary="Получить список запросов",
* description="Метод для оздания запроса, если не передан параметр <b>user_id</b>, то будет получен список текущего пользователя",
* security={
* {"bearerAuth": {}}
* },
* tags={"Requests"},
*
* @OA\RequestBody(
* @OA\MediaType(
* mediaType="multipart/form-data",
* @OA\Schema(
* required={"position_id", "title", "status"},
* @OA\Property(
* property="user_id",
* type="integer",
* description="Идентификатор пользователя",
* ),
* @OA\Property(
* property="title",
* type="string",
* description="Заголовок запроса",
* ),
* @OA\Property(
* property="position_id",
* type="integer",
* description="Позиция",
* ),
* @OA\Property(
* property="knowledge_level_id",
* type="integer",
* description="Уровень",
* ),
* @OA\Property(
* property="specialist_count",
* type="integer",
* description="Количество специалистов",
* ),
* @OA\Property(
* property="status",
* type="integer",
* description="Статус запроса",
* ),
* @OA\Property(
* property="descr",
* type=" string",
* description="Описание запроса",
* ),
* @OA\Property(
* property="skill_ids",
* type="array",
* description="Навыки",
* @OA\Items(
* type="integer",
* ),
* ),
* ),
* ),
* ),
* @OA\Response(
* response=200,
* description="Возвращает объект Запроса",
* @OA\MediaType(
* mediaType="application/json",
* @OA\Schema(ref="#/components/schemas/Request"),
* ),
* ),
* )
*
* @return Request
* @throws BadRequestHttpException
*/
public function actionCreateRequest()
{
$user_id = \Yii::$app->user->id;
if (!$user_id){
throw new BadRequestHttpException(json_encode(['Пользователь не найден']));
}
$requestService = RequestService::run()
->setUserId($user_id)
->load(\Yii::$app->request->post(), '')
->save();
if (!$requestService->isSave){
throw new BadRequestHttpException(json_encode($requestService->errors));
}
return $requestService->getModel();
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace frontend\modules\api\models;
/**
* @OA\Schema(
* schema="Position",
* @OA\Property(
* property="id",
* type="int",
* example=1,
* description="Идентификатор позиции"
* ),
* @OA\Property(
* property="name",
* type="string",
* example="Back end - разработчик",
* description="Название позиции"
* ),
*)
*/
class Position extends \common\models\Position
{
}

View File

@ -0,0 +1,110 @@
<?php
namespace frontend\modules\api\models;
/**
* @OA\Schema(
* schema="Request",
* @OA\Property(
* property="id",
* type="int",
* example=12,
* description="Идентификатор запроса"
* ),
* @OA\Property(
* property="title",
* type="string",
* example="PHP Developer",
* description="Идентификатор пользователя"
* ),
* @OA\Property(
* property="created_at",
* type="datetime",
* example="2023-04-07 02:09:42",
* description="Дата и время создания"
* ),
* @OA\Property(
* property="updated_at",
* type="datetime",
* example="2023-04-10 16:20:48",
* description="Дата и время обновления"
* ),
* @OA\Property(
* property="user_id",
* type="integer",
* example=19,
* description="Идентификатор пользователя"
* ),
* @OA\Property(
* property="position_id",
* type="int",
* example=1,
* description="Идентификатор позиции"
* ),
* @OA\Property(
* property="position",
* ref="#/components/schemas/Position"
* ),
* @OA\Property(
* property="skill_ids",
* type="array",
* @OA\Items(
* type="integer",
* ),
* example="[1,2]",
* description="Идентификаторы навыков"
* ),
* @OA\Property(
* property="knowledge_level_id",
* type="int",
* example=2,
* description="Идентификатор ровня разработчика"
* ),
* @OA\Property(
* property="descr",
* type="string",
* example="Необходим разрабочик со знанием PHP и Laravel",
* description="Идентификатор ровня разработчика"
* ),
* @OA\Property(
* property="specialist_count",
* type="int",
* example=2,
* description="Колличество необходимых специалистов"
* ),
* @OA\Property(
* property="status",
* type="int",
* example=1,
* description="Статус запроса"
* ),
* @OA\Property(
* property="skills",
* ref="#/components/schemas/SkillsExample",
* ),
* @OA\Property(
* property="result_count",
* type="int",
* example=6,
* description="Количество найденых профилей"
* ),
* @OA\Property(
* property="level",
* type="string",
* example="Middle",
* description="Текстовое наименование уровня знаний"
* ),
*)
*
* @OA\Schema(
* schema="RequestsExample",
* type="array",
* @OA\Items(
* ref="#/components/schemas/Request",
* ),
*)
*/
class Request extends \common\models\Request
{
}

View File

@ -0,0 +1,41 @@
<?php
namespace frontend\modules\api\models;
/**
* @OA\Schema(
* schema="Skill",
* @OA\Property(
* property="id",
* type="int",
* example=1,
* description="Идентификатор навыка"
* ),
* @OA\Property(
* property="name",
* type="string",
* example="PHP",
* description="Название навыка"
* ),
*)
*
* @OA\Schema(
* schema="SkillsExample",
* type="array",
* example={{"id": 1, "name": "PHP"}, {"id": 2, "name": "Yii2"}},
* @OA\Items(
* type="object",
* @OA\Property(
* property="id",
* type="integer",
* ),
* @OA\Property(
* property="name",
* type="string",
* ),
* ),
*)
*/
class Skill extends \common\models\Skill
{
}

1
frontend/web/api-doc Submodule

@ -0,0 +1 @@
Subproject commit 3548ef37c2a70316db7f2cc331a3130acfb8ea8c