fix draft only created for user who creates them

This commit is contained in:
StudioTem committed 2025-12-15 14:27:32 +01:00
1 parent 584f708076
commit 604dc4f988
4 files changed
+178 -15

No files matched your search

+8 -1
View File
@@ -15,7 +15,7 @@ class SubTaskResource extends JsonResource
*/
public function toArray($request)
{
return [
$data = [
'id' => $this->id,
'is_draft' => $this->is_draft,
'type' => $this->type,
@@ -40,5 +40,12 @@ class SubTaskResource extends JsonResource
'files' => AttachmentResource::collection($this->attachments->isNotEmpty() ? $this->attachments : $this->mastertask->attachments),
'color' => $this->mastertask->color,
];
// Pre drafty pridáme employees dáta
if ($this->is_draft && $this->draft_data) {
$data['employees'] = $this->draft_data;
}
return $data;
}
}