mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-31 13:44:35 -04:00
Documents for tasks
This commit is contained in:
parent
4c08187bf1
commit
f1c5f37189
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
namespace App\Transformers;
|
namespace App\Transformers;
|
||||||
|
|
||||||
|
use App\Models\Document;
|
||||||
use App\Models\Task;
|
use App\Models\Task;
|
||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
|
|
||||||
@ -22,14 +23,23 @@ class TaskTransformer extends EntityTransformer
|
|||||||
use MakesHash;
|
use MakesHash;
|
||||||
|
|
||||||
protected $defaultIncludes = [
|
protected $defaultIncludes = [
|
||||||
|
'documents'
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $availableIncludes = [
|
protected $availableIncludes = [
|
||||||
|
'documents'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
public function includeDocuments(Vendor $vendor)
|
||||||
|
{
|
||||||
|
$transformer = new DocumentTransformer($this->serializer);
|
||||||
|
|
||||||
|
return $this->includeCollection($task->documents, $transformer, Document::class);
|
||||||
|
}
|
||||||
|
|
||||||
public function transform(Task $task)
|
public function transform(Task $task)
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
@ -140,4 +140,18 @@ class DocumentsApiTest extends TestCase
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// public function testTaskDocuments()
|
||||||
|
// {
|
||||||
|
|
||||||
|
// $response = $this->withHeaders([
|
||||||
|
// 'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
|
// 'X-API-TOKEN' => $this->token,
|
||||||
|
// ])->get('/api/v1/tasks');
|
||||||
|
|
||||||
|
// $response->assertStatus(200);
|
||||||
|
// $arr = $response->json();
|
||||||
|
// $this->assertArrayHasKey('documents', $arr['data'][0]);
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user