Fix: CardDAV sync broke when todo items didn't have a creation date. Also fixed todos without a due date not being displays and wrong calculation of warning badge states.

This commit is contained in:
2026-05-25 15:31:29 +02:00
parent 2324ad95bf
commit da3ceeaff3
5 changed files with 95 additions and 45 deletions
+6 -3
View File
@@ -19,7 +19,7 @@ public function index()
* Display a listing of the resource.
* @param Request $request
* @param string $modelType The type of the model (e.g., 'Customer', 'Invoice')
* @param string $modelId The ID of the model
* @param int $modelId The ID of the model
* @return \Illuminate\Http\JsonResponse
*/
public function todosForModel(Request $request, string $modelType, int $modelId)
@@ -27,9 +27,12 @@ public function todosForModel(Request $request, string $modelType, int $modelId)
$model = app("App\\Models\\" . $modelType)::findOrFail($modelId);
// Load all todos of the model with the user relationship
$todos = $model->todos()->with('type')->orderBy('created_at', 'desc')->get();
$todos = $model->todos()
->with('type')
->orderBy('created_at', 'desc')
->get();
// Transformiere die Daten in camelCase
// Transform data to camelCase
$notesArray = $todos->map(function ($todo) {
return ApiDataTransformer::snakeToCamel($todo->toArray());
});