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:
@@ -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());
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user