repository = $repository; } public function update(int $id): void { try { $order = $this->repository->findOrder($id); if ($order === null) { $this->json(['success' => false, 'error' => 'Auftrag nicht gefunden'], 404); return; } $input = $this->getJsonInput(); if (!isset($input['title']) || trim((string) $input['title']) === '') { $this->json(['success' => false, 'error' => 'Titel ist erforderlich'], 400); return; } if (!isset($input['briefing']) || trim((string) $input['briefing']) === '') { $this->json(['success' => false, 'error' => 'Briefing ist erforderlich'], 400); return; } $this->repository->updateOrder($id, [ 'title' => $input['title'], 'briefing' => $input['briefing'], 'author_profile_id' => $input['author_profile_id'] ?? null, 'contract_id' => $input['contract_id'] ?? null, 'structure_id' => $input['structure_id'] ?? null, ]); $updatedOrder = $this->repository->findOrder($id); $this->json([ 'success' => true, 'data' => $updatedOrder, ]); } catch (\Exception $e) { $this->jsonError($e->getMessage()); } } }