swagger tasks

This commit is contained in:
2023-04-26 01:22:02 +03:00
parent 226f2daa34
commit 50b9722e82
6 changed files with 242 additions and 8 deletions

View File

@ -106,7 +106,7 @@ class Project extends \yii\db\ActiveRecord
*/
public function getColumns()
{
return $this->hasMany(ProjectColumn::class, ['project_id' => 'id'])->with('tasks');
return $this->hasMany(ProjectColumn::class, ['project_id' => 'id'])->with('tasks')->where(['status' => ProjectColumn::STATUS_ACTIVE]);
}
/**

View File

@ -123,6 +123,6 @@ class ProjectColumn extends \yii\db\ActiveRecord
*/
public function getTasks()
{
return $this->hasMany(ProjectTask::class, ['column_id' => 'id'])->with('taskUsers');
return $this->hasMany(ProjectTask::class, ['column_id' => 'id'])->with('taskUsers')->where(['status' => ProjectTask::STATUS_ACTIVE]);
}
}

View File

@ -28,6 +28,8 @@ use yii\helpers\ArrayHelper;
*/
class ProjectTask extends ActiveRecord
{
const STATUS_ACTIVE = 1;
const STATUS_DISABLE = 0;
/**
* {@inheritdoc}
*/
@ -103,6 +105,17 @@ class ProjectTask extends ActiveRecord
];
}
/**
* @return string[]
*/
public static function getStatus(): array
{
return [
self::STATUS_ACTIVE => 'Активен',
self::STATUS_DISABLE => 'Выключен'
];
}
public function beforeDelete()
{
foreach ($this->taskUsers as $taskUser) {