project users, column priority
This commit is contained in:
@ -49,6 +49,10 @@ use yii\web\Linkable;
|
||||
* property="columns",
|
||||
* ref="#/components/schemas/ProjectColumnExample",
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="projectUsers",
|
||||
* ref="#/components/schemas/ProjectUsersExample",
|
||||
* ),
|
||||
*)
|
||||
*
|
||||
* @OA\Schema(
|
||||
@ -85,6 +89,10 @@ use yii\web\Linkable;
|
||||
* property="company",
|
||||
* ref="#/components/schemas/Company",
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="projectUsers",
|
||||
* ref="#/components/schemas/ProjectUsers",
|
||||
* ),
|
||||
* ),
|
||||
*)
|
||||
*
|
||||
@ -107,7 +115,7 @@ class Project extends \common\models\Project
|
||||
'company' => function() {
|
||||
return $this->company;
|
||||
},
|
||||
|
||||
'projectUsers',
|
||||
];
|
||||
}
|
||||
|
||||
@ -116,6 +124,14 @@ class Project extends \common\models\Project
|
||||
return ['columns',];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ActiveQuery
|
||||
*/
|
||||
public function getProjectUsers()
|
||||
{
|
||||
return $this->hasMany(ProjectUser::class, ['project_id' => 'id']);
|
||||
}
|
||||
|
||||
public function getLinks(): array
|
||||
{
|
||||
return [
|
||||
|
@ -31,6 +31,12 @@ namespace frontend\modules\api\models;
|
||||
* description="Статус колонки"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="priority",
|
||||
* type="int",
|
||||
* example="1",
|
||||
* description="Приоритет колонки"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="tasks",
|
||||
* ref="#/components/schemas/ProjectTask",
|
||||
* ),
|
||||
@ -40,7 +46,7 @@ namespace frontend\modules\api\models;
|
||||
* schema="ProjectColumnExample",
|
||||
* type="array",
|
||||
* example={
|
||||
* {"id": 1, "title": "Задачи на проверку", "project_id": 95, "status": 1,
|
||||
* {"id": 1, "title": "Задачи на проверку", "project_id": 95, "status": 1, "priority": 1,
|
||||
* "tasks": {
|
||||
* {"id": 95, "title": "Сложная задача", "project_id": 44, "column_id": 1, "user_id": 19, "description": "Описание задачи", "status": 1,
|
||||
* "taskUsers": {
|
||||
@ -56,7 +62,7 @@ namespace frontend\modules\api\models;
|
||||
* }
|
||||
* }
|
||||
* },
|
||||
* {"id": 2, "title": "Новые задачи", "project_id": 95, "status": 1,
|
||||
* {"id": 2, "title": "Новые задачи", "project_id": 95, "status": 1, "priority": 2,
|
||||
* "tasks": {
|
||||
* {"id": 97, "title": "Очень Сложная задача", "project_id": 44, "column_id": 2, "user_id": 19, "description": "Описание простой задачи", "status": 1},
|
||||
* {"id": 98, "title": "Очень Простая задача", "project_id": 44, "column_id": 2, "user_id": 19, "description": "Описание очень простой задачи", "status": 1}
|
||||
@ -82,6 +88,10 @@ namespace frontend\modules\api\models;
|
||||
* type="int",
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="priority",
|
||||
* type="int",
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="tasks",
|
||||
* ref="#/components/schemas/ProjectTask",
|
||||
* ),
|
||||
|
70
frontend/modules/api/models/ProjectUser.php
Normal file
70
frontend/modules/api/models/ProjectUser.php
Normal file
@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace frontend\modules\api\models;
|
||||
|
||||
/**
|
||||
*
|
||||
* @OA\Schema(
|
||||
* schema="ProjectUsers",
|
||||
* @OA\Property(
|
||||
* property="project_id",
|
||||
* type="int",
|
||||
* example=1,
|
||||
* description="Идентификатор проекта"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="user_id",
|
||||
* type="int",
|
||||
* example=1,
|
||||
* description="Идентификатор пользователя"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="user",
|
||||
* ref="#/components/schemas/ProjectTaskUsersShortExample",
|
||||
* description="Пользователи проекта"
|
||||
* ),
|
||||
*)
|
||||
*
|
||||
* @OA\Schema(
|
||||
* schema="ProjectUsersExample",
|
||||
* type="array",
|
||||
* example={
|
||||
* {"project_id": 20, "user_id": 19, "user": {"fio": "Иванов Иван Иванович", "avatar": "/profileava/m6.png"}},
|
||||
* {"project_id": 20, "user_id": 20, "user": {"fio": "Петров Петр Петрович", "avatar": "/profileava/m2.png"}},
|
||||
* },
|
||||
* @OA\Items(
|
||||
* type="object",
|
||||
* @OA\Property(
|
||||
* property="project_id",
|
||||
* type="integer",
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="user_id",
|
||||
* type="integer",
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="user",
|
||||
* ref="#/components/schemas/ProjectTaskUsersShortExample",
|
||||
* ),
|
||||
* ),
|
||||
*)
|
||||
*
|
||||
*/
|
||||
class ProjectUser extends \common\models\ProjectUser
|
||||
{
|
||||
|
||||
public function fields()
|
||||
{
|
||||
return [
|
||||
'project_id',
|
||||
'user_id',
|
||||
'user' => function(){
|
||||
return [
|
||||
'fio' => $this->user->userCard->fio ?? $this->user->email,
|
||||
'avatar' => $this->user->userCard->photo ?? ''
|
||||
];
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user