weitere perfektionierung der neuen mobile app

This commit is contained in:
Codex Agent
2025-12-11 12:18:08 +01:00
parent 7b01a77083
commit b4417db5cd
38 changed files with 4265 additions and 3040 deletions

View File

@@ -125,7 +125,7 @@ class TaskController extends Controller
$task->update($payload);
$task->load(['taskCollection', 'assignedEvents']);
$task->load(['taskCollection', 'assignedEvents', 'eventType', 'emotion']);
return response()->json([
'message' => 'Task erfolgreich aktualisiert.',
@@ -357,6 +357,10 @@ class TaskController extends Controller
$data['priority'] = $original?->priority ?? 'medium';
}
if (array_key_exists('emotion_id', $data) && empty($data['emotion_id'])) {
$data['emotion_id'] = null;
}
return $data;
}

View File

@@ -51,6 +51,21 @@ class TaskStoreRequest extends FormRequest
$fail('Der Benutzer gehört nicht zu diesem Tenant.');
}
}],
'emotion_id' => ['nullable', 'exists:emotions,id', function ($attribute, $value, $fail) use ($tenantId) {
$accessible = \App\Models\Emotion::where('id', $value)
->where(function ($query) use ($tenantId) {
$query->whereNull('tenant_id');
if ($tenantId) {
$query->orWhere('tenant_id', $tenantId);
}
})
->exists();
if (! $accessible) {
$fail('Die Emotion gehört nicht zu diesem Tenant.');
}
}],
];
}

View File

@@ -51,6 +51,21 @@ class TaskUpdateRequest extends FormRequest
$fail('Der Benutzer gehört nicht zu diesem Tenant.');
}
}],
'emotion_id' => ['sometimes', 'nullable', 'exists:emotions,id', function ($attribute, $value, $fail) use ($tenantId) {
$accessible = \App\Models\Emotion::where('id', $value)
->where(function ($query) use ($tenantId) {
$query->whereNull('tenant_id');
if ($tenantId) {
$query->orWhere('tenant_id', $tenantId);
}
})
->exists();
if (! $accessible) {
$fail('Die Emotion gehört nicht zu diesem Tenant.');
}
}],
];
}