feat: harden tenant settings and import pipeline
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Http\Resources\Tenant;
|
||||
|
||||
use App\Http\Resources\Tenant\EventResource;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
@@ -15,28 +14,27 @@ class TaskResource extends JsonResource
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
$assignedEventsCount = $this->relationLoaded('assignedEvents')
|
||||
? $this->assignedEvents->count()
|
||||
: $this->assignedEvents()->count();
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'tenant_id' => $this->tenant_id,
|
||||
'title' => $this->title,
|
||||
'description' => $this->description,
|
||||
'priority' => $this->priority,
|
||||
'due_date' => $this->due_date?->toISOString(),
|
||||
'is_completed' => $this->is_completed,
|
||||
'is_completed' => (bool) $this->is_completed,
|
||||
'collection_id' => $this->collection_id,
|
||||
'assigned_events_count' => $this->assignedEvents()->count(),
|
||||
// TaskCollectionResource wird später implementiert
|
||||
// 'collection' => $this->whenLoaded('taskCollection', function () {
|
||||
// return new TaskCollectionResource($this->taskCollection);
|
||||
// }),
|
||||
'assigned_events' => $this->whenLoaded('assignedEvents', function () {
|
||||
return EventResource::collection($this->assignedEvents);
|
||||
}),
|
||||
// UserResource wird später implementiert
|
||||
// 'assigned_to' => $this->whenLoaded('assignedTo', function () {
|
||||
// return new UserResource($this->assignedTo);
|
||||
// }),
|
||||
'created_at' => $this->created_at->toISOString(),
|
||||
'updated_at' => $this->updated_at->toISOString(),
|
||||
'assigned_events_count' => $assignedEventsCount,
|
||||
'assigned_events' => $this->whenLoaded(
|
||||
'assignedEvents',
|
||||
fn () => EventResource::collection($this->assignedEvents)
|
||||
),
|
||||
'created_at' => $this->created_at?->toISOString(),
|
||||
'updated_at' => $this->updated_at?->toISOString(),
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user