Merge pull request #2745 from RnBConsulting/develop

Add user id and displayname in task status (API) v2
This commit is contained in:
Hillel Coren 2019-03-22 09:00:18 +02:00 committed by GitHub
commit 96d9b162c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -45,7 +45,7 @@ class TaskApiController extends BaseAPIController
{
$tasks = Task::scope()
->withTrashed()
->with('client', 'invoice', 'project', 'task_status')
->with('client', 'invoice', 'project', 'task_status', 'user')
->orderBy('updated_at', 'desc');
return $this->listResponse($tasks);

View File

@ -63,6 +63,8 @@ class TaskTransformer extends EntityTransformer
{
return array_merge($this->getDefaults($task), [
'id' => (int) $task->public_id,
'user_id' => (int) $task->user->public_id,
'user' => $task->user->getDisplayName(),
'description' => $task->description ?: '',
'duration' => $task->getDuration() ?: 0,
'updated_at' => (int) $this->getTimestamp($task->updated_at),