add import tasks to xlsx
This commit is contained in:
150
frontend/modules/api/models/project/Project.php
Normal file
150
frontend/modules/api/models/project/Project.php
Normal file
@ -0,0 +1,150 @@
|
||||
<?php
|
||||
|
||||
namespace frontend\modules\api\models\project;
|
||||
|
||||
use frontend\modules\api\models\Company;
|
||||
use yii\db\ActiveQuery;
|
||||
use yii\helpers\Url;
|
||||
use yii\web\Link;
|
||||
use yii\web\Linkable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @OA\Schema(
|
||||
* schema="Project",
|
||||
* @OA\Property(
|
||||
* property="id",
|
||||
* type="int",
|
||||
* example=95,
|
||||
* description="Идентификатор проекта"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="name",
|
||||
* type="string",
|
||||
* example="PHP",
|
||||
* description="Название проекта"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="status",
|
||||
* type="int",
|
||||
* example="10",
|
||||
* description="Статус проекта"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="hh_id",
|
||||
* type="int",
|
||||
* example="234",
|
||||
* description="Идентификатор проекта на hh.ru"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="owner_id",
|
||||
* type="int",
|
||||
* example="19",
|
||||
* description="Идентификатор владельца проекта"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="company",
|
||||
* ref="#/components/schemas/Company",
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="columns",
|
||||
* ref="#/components/schemas/ProjectColumnExample",
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="projectUsers",
|
||||
* ref="#/components/schemas/ProjectUsersExample",
|
||||
* ),
|
||||
*)
|
||||
*
|
||||
* @OA\Schema(
|
||||
* schema="ProjectExample",
|
||||
* type="array",
|
||||
* @OA\Items(
|
||||
* type="object",
|
||||
* @OA\Property(
|
||||
* property="id",
|
||||
* type="integer",
|
||||
* example="1"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="name",
|
||||
* type="string",
|
||||
* example="OhDesign - backend"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="status",
|
||||
* type="integer",
|
||||
* example="10"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="hh_id",
|
||||
* type="integer",
|
||||
* example="345343434"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="owner_id",
|
||||
* type="integer",
|
||||
* example="19"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="company",
|
||||
* ref="#/components/schemas/Company",
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="projectUsers",
|
||||
* ref="#/components/schemas/ProjectUsers",
|
||||
* ),
|
||||
* ),
|
||||
*)
|
||||
*
|
||||
*/
|
||||
class Project extends \common\models\Project
|
||||
{
|
||||
const STATUS_OTHER = 19;
|
||||
const STATUS_CLOSE = 10;
|
||||
public function fields(): array
|
||||
{
|
||||
return [
|
||||
'id',
|
||||
'name',
|
||||
//'budget',
|
||||
'status',
|
||||
'hh_id' => function() {
|
||||
return $this->hh;
|
||||
},
|
||||
'owner_id',
|
||||
'company' => function() {
|
||||
return $this->company;
|
||||
},
|
||||
'projectUsers',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function extraFields(): array
|
||||
{
|
||||
return ['columns', 'mark'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ActiveQuery
|
||||
*/
|
||||
public function getProjectUsers()
|
||||
{
|
||||
return $this->hasMany(ProjectUser::class, ['project_id' => 'id']);
|
||||
}
|
||||
|
||||
public function getLinks(): array
|
||||
{
|
||||
return [
|
||||
Link::REL_SELF => Url::to(['index', 'project_id' => $this->id], true),
|
||||
];
|
||||
}
|
||||
|
||||
public function getCompany(): ActiveQuery
|
||||
{
|
||||
return $this->hasOne(Company::className(), ['id' => 'company_id']);
|
||||
}
|
||||
}
|
117
frontend/modules/api/models/project/ProjectColumn.php
Normal file
117
frontend/modules/api/models/project/ProjectColumn.php
Normal file
@ -0,0 +1,117 @@
|
||||
<?php
|
||||
|
||||
namespace frontend\modules\api\models\project;
|
||||
|
||||
/**
|
||||
*
|
||||
* @OA\Schema(
|
||||
* schema="ProjectColumn",
|
||||
* @OA\Property(
|
||||
* property="id",
|
||||
* type="int",
|
||||
* example=95,
|
||||
* description="Идентификатор колонки"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="title",
|
||||
* type="string",
|
||||
* example="Задачи на проверку",
|
||||
* description="Название колонки"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="project_id",
|
||||
* type="int",
|
||||
* example="95",
|
||||
* description="Проект к которому относится колонка"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="status",
|
||||
* type="int",
|
||||
* example="1",
|
||||
* description="Статус колонки"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="priority",
|
||||
* type="int",
|
||||
* example="1",
|
||||
* description="Приоритет колонки"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="tasks",
|
||||
* ref="#/components/schemas/ProjectTask",
|
||||
* ),
|
||||
*)
|
||||
*
|
||||
* @OA\Schema(
|
||||
* schema="ProjectColumnExample",
|
||||
* type="array",
|
||||
* example={
|
||||
* {"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, "comment_count": 3,
|
||||
* "taskUsers": {
|
||||
* {"id": 2, "task_id": 95, "user_id": 2, "fio": "Сапронов Антон Викторович", "avatar": "/profileava/m8.png"},
|
||||
* {"id": 3, "task_id": 95, "user_id": 3, "fio": "Иванов Иван Иванович", "avatar": "/profileava/m2.png"},
|
||||
* },
|
||||
* "timers": {
|
||||
* {"id": 12, "created_at": "2023-04-07 02:09:42", "stopped_at": "2023-04-10 16:20:48", "user_id": 19, "entity_type": 2, "entity_id": 95, "deltaSeconds": 456, "status": 1}
|
||||
* }
|
||||
* },
|
||||
* {"id": 96, "title": "Простая задача", "project_id": 44, "column_id": 1, "user_id": 19, "description": "Описание простой задачи", "status": 1, "comment_count": 4,
|
||||
* "taskUsers": {
|
||||
* {"id": 3, "task_id": 96, "user_id": 3, "fio": "Иванов Иван Иванович", "avatar": "/profileava/m2.png"},
|
||||
* {"id": 4, "task_id": 96, "user_id": 4, "fio": "Петров Петр Петрович", "avatar": "/profileava/m7.png"},
|
||||
* },
|
||||
* "timers": {
|
||||
* {"id": 13, "created_at": "2023-04-08 02:09:42", "stopped_at": "2023-04-09 16:20:48", "user_id": 19, "entity_type": 2, "entity_id": 96, "deltaSeconds": 654, "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, "comment_count": 2,
|
||||
* "taskUsers": {},
|
||||
* "timers": {}
|
||||
* },
|
||||
* {"id": 98, "title": "Очень Простая задача", "project_id": 44, "column_id": 2, "user_id": 19, "description": "Описание очень простой задачи", "status": 1, "comment_count": 3,
|
||||
* "taskUsers": {},
|
||||
* "timers": {}
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* },
|
||||
* @OA\Items(
|
||||
* type="object",
|
||||
* @OA\Property(
|
||||
* property="id",
|
||||
* type="int",
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="title",
|
||||
* type="string",
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="project_id",
|
||||
* type="int",
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="status",
|
||||
* type="int",
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="priority",
|
||||
* type="int",
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="tasks",
|
||||
* ref="#/components/schemas/ProjectTask",
|
||||
* ),
|
||||
* ),
|
||||
*)
|
||||
*
|
||||
*/
|
||||
class ProjectColumn extends \common\models\ProjectColumn
|
||||
{
|
||||
|
||||
}
|
207
frontend/modules/api/models/project/ProjectTask.php
Normal file
207
frontend/modules/api/models/project/ProjectTask.php
Normal file
@ -0,0 +1,207 @@
|
||||
<?php
|
||||
|
||||
namespace frontend\modules\api\models\project;
|
||||
|
||||
/**
|
||||
*
|
||||
* @OA\Schema(
|
||||
* schema="ProjectTask",
|
||||
* @OA\Property(
|
||||
* property="id",
|
||||
* type="int",
|
||||
* example=95,
|
||||
* description="Идентификатор задачи"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="title",
|
||||
* type="string",
|
||||
* example="Задачи на проверку",
|
||||
* description="Заголовок задачи"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="project_id",
|
||||
* type="int",
|
||||
* example="95",
|
||||
* description="Проект к которому относится задача"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="column_id",
|
||||
* type="int",
|
||||
* example="23",
|
||||
* description="Колонка к которой относится задача"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="user_id",
|
||||
* type="int",
|
||||
* example="19",
|
||||
* description="Идентификатор пользователя создавшего задачу"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="user",
|
||||
* ref="#/components/schemas/ProjectTaskUsersShortExample",
|
||||
* description="Пользователь создавший задачу"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="dead_line",
|
||||
* type="string",
|
||||
* example="2023-04-21 00:44:53",
|
||||
* description="Срок выполнения задачи"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="executor_id",
|
||||
* type="int",
|
||||
* example="2",
|
||||
* description="Идентификатор исполнителя задачи"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="executor",
|
||||
* ref="#/components/schemas/ProjectTaskUsersShortExample",
|
||||
* description="Исполнитель задачи"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="description",
|
||||
* type="string",
|
||||
* example="Описание задачи",
|
||||
* description="Описание задачи"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="priority",
|
||||
* type="int",
|
||||
* example="1",
|
||||
* description="Приоритет задачи"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="execution_priority",
|
||||
* type="integer",
|
||||
* example="2",
|
||||
* description="Приоритет выполнения задачи (0 - low, 1 - medium, 2 - high)",
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="status",
|
||||
* type="int",
|
||||
* example="1",
|
||||
* description="Статус задачи"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="comment_count",
|
||||
* type="int",
|
||||
* example="5",
|
||||
* description="Кол-во комментариев"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="taskUsers",
|
||||
* ref="#/components/schemas/ProjectTaskUsersExample",
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="timers",
|
||||
* ref="#/components/schemas/TimerExample",
|
||||
* ),
|
||||
*)
|
||||
*
|
||||
* @OA\Schema(
|
||||
* schema="ProjectTaskExample",
|
||||
* type="array",
|
||||
* @OA\Items(
|
||||
* type="object",
|
||||
* ref="#/components/schemas/ProjectTask",
|
||||
* ),
|
||||
*)
|
||||
*
|
||||
*
|
||||
* @OA\Schema(
|
||||
* schema="ProjectTaskUsersExample",
|
||||
* type="array",
|
||||
* @OA\Items(
|
||||
* type="object",
|
||||
* @OA\Property(
|
||||
* property="id",
|
||||
* type="integer",
|
||||
* example="1"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="task_id",
|
||||
* type="integer",
|
||||
* example="1"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="user_id",
|
||||
* type="integer",
|
||||
* example="19"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="fio",
|
||||
* type="string",
|
||||
* example="Сапронов Антон Викторович"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="avatar",
|
||||
* type="string",
|
||||
* example="/profileava/m8.png"
|
||||
* ),
|
||||
* ),
|
||||
*)
|
||||
*
|
||||
* @OA\Schema(
|
||||
* schema="ProjectTaskUsersShortExample",
|
||||
* @OA\Property(
|
||||
* property="fio",
|
||||
* type="string",
|
||||
* example="Сапронов Антон Викторович"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="avatar",
|
||||
* type="string",
|
||||
* example="/profileava/m8.png"
|
||||
* ),
|
||||
*)
|
||||
*
|
||||
* @OA\Schema(
|
||||
* schema="ProjectTaskReportsExample",
|
||||
* type="array",
|
||||
* @OA\Items(
|
||||
* @OA\Property(
|
||||
* property="id",
|
||||
* type="integer",
|
||||
* example=1
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="report_id",
|
||||
* type="integer",
|
||||
* example=12
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="task",
|
||||
* type="string",
|
||||
* example="Задача"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="hours_spent",
|
||||
* type="integer",
|
||||
* example=2
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="created_at",
|
||||
* type="integer",
|
||||
* example=1671148800
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="status",
|
||||
* type="integer",
|
||||
* example=1
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="minutes_spent",
|
||||
* type="integer",
|
||||
* example=0
|
||||
* ),
|
||||
* )
|
||||
*
|
||||
*
|
||||
|
||||
*)
|
||||
*
|
||||
*/
|
||||
class ProjectTask extends \common\models\ProjectTask
|
||||
{
|
||||
|
||||
}
|
27
frontend/modules/api/models/project/ProjectTaskUser.php
Normal file
27
frontend/modules/api/models/project/ProjectTaskUser.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace frontend\modules\api\models\project;
|
||||
|
||||
/**
|
||||
*
|
||||
* @OA\Schema(
|
||||
* schema="ProjectTaskUser",
|
||||
* @OA\Property(
|
||||
* property="user_id",
|
||||
* type="int",
|
||||
* example=19,
|
||||
* description="Идентификатор пользователя"
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="task_user",
|
||||
* type="int",
|
||||
* example=23,
|
||||
* description="Идентификатор задачи"
|
||||
* ),
|
||||
*)
|
||||
*
|
||||
*/
|
||||
class ProjectTaskUser extends \common\models\ProjectTaskUser
|
||||
{
|
||||
|
||||
}
|
70
frontend/modules/api/models/project/ProjectUser.php
Normal file
70
frontend/modules/api/models/project/ProjectUser.php
Normal file
@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace frontend\modules\api\models\project;
|
||||
|
||||
/**
|
||||
*
|
||||
* @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