This commit is contained in:
Kavalar 2023-05-23 14:05:09 +03:00
parent 5da6746cc4
commit c834f7da7a
5 changed files with 56 additions and 1 deletions

View File

@ -2,6 +2,7 @@
namespace common\models; namespace common\models;
use Mpdf\Tag\Th;
use Yii; use Yii;
use yii\behaviors\TimestampBehavior; use yii\behaviors\TimestampBehavior;
use yii\db\Expression; use yii\db\Expression;
@ -80,6 +81,32 @@ class Comment extends \yii\db\ActiveRecord
]; ];
} }
public function fields(): array
{
return [
'id',
'created_at',
'updated_at',
'user_id',
'user' => function () {
return [
"fio" => $this->user->userCard->fio ?? $this->user->username,
"avatar" => $this->user->userCard->photo ?? '',
];
},
'parent_id',
'entity_type',
'entity_id',
'status',
'text',
];
}
public function getUser()
{
return $this->hasOne(User::class, ['id' => 'user_id']);
}
/** /**
* @return string[] * @return string[]
*/ */

View File

@ -56,6 +56,9 @@ class ManagerEmployee extends \yii\db\ActiveRecord
'id', 'id',
'manager_id', 'manager_id',
'employee_id', 'employee_id',
'user_id' => function(){
return $this->employee_id;
},
'employee' => function () { 'employee' => function () {
return [ return [
"fio" => $this->employee->userCard->fio ?? $this->employee->username, "fio" => $this->employee->userCard->fio ?? $this->employee->username,
@ -73,6 +76,11 @@ class ManagerEmployee extends \yii\db\ActiveRecord
return $this->hasOne(User::class, ['id' => 'employee_id']); return $this->hasOne(User::class, ['id' => 'employee_id']);
} }
public function getUser()
{
return $this->hasOne(User::class, ['id' => 'employee_id']);
}
/** /**
* @return ActiveQuery * @return ActiveQuery
*/ */

View File

@ -76,7 +76,7 @@ class CommentController extends ApiController
* @OA\MediaType( * @OA\MediaType(
* mediaType="multipart/form-data", * mediaType="multipart/form-data",
* @OA\Schema( * @OA\Schema(
* required={"text"}, * required={"text", "entity_type", "entity_id"},
* @OA\Property( * @OA\Property(
* property="text", * property="text",
* type="string", * type="string",
@ -93,6 +93,11 @@ class CommentController extends ApiController
* description="Идентификатор сущности", * description="Идентификатор сущности",
* ), * ),
* @OA\Property( * @OA\Property(
* property="parent_id",
* type="integer",
* description="Идентификатор родительского комментария",
* ),
* @OA\Property(
* property="status", * property="status",
* type="integer", * type="integer",
* description="Статус комментария", * description="Статус комментария",

View File

@ -79,6 +79,11 @@ class TaskController extends ApiController
* type="integer", * type="integer",
* description="Идентификатор создателя задачи", * description="Идентификатор создателя задачи",
* ), * ),
* @OA\Property(
* property="executor_id",
* type="integer",
* description="Идентификатор исполнителя задачи",
* ),
* ), * ),
* ), * ),
* ), * ),
@ -271,6 +276,11 @@ class TaskController extends ApiController
* nullable=false, * nullable=false,
* ), * ),
* @OA\Property( * @OA\Property(
* property="executor_id",
* type="integer",
* description="Идентификатор исполнителя задачи",
* ),
* @OA\Property(
* property="task_id", * property="task_id",
* type="integer", * type="integer",
* description="Идентификатор задачи", * description="Идентификатор задачи",

View File

@ -45,6 +45,11 @@ namespace frontend\modules\api\models;
* example="19" * example="19"
* ), * ),
* @OA\Property( * @OA\Property(
* property="user_id",
* type="integer",
* example="19"
* ),
* @OA\Property(
* property="employee", * property="employee",
* type="object", * type="object",
* ref="#/components/schemas/ProjectTaskUsersShortExample", * ref="#/components/schemas/ProjectTaskUsersShortExample",