{
"event": "PreToolUse",
"tool_name": "Read",
"tool_input": {
"file_path": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Controller\/Api\/DocsController.php",
"offset": 145,
"limit": 100
}
}
{
"tool_response": {
"type": "text",
"file": {
"filePath": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Controller\/Api\/DocsController.php",
"content": " \/**\n * POST \/api\/v1\/docs\n * Neues Dokument erstellen.\n *\/\n public function store(): void\n {\n try {\n $input = $this->getJsonInput();\n\n $required = ['title', 'slug'];\n foreach ($required as $field) {\n if (empty($input[$field])) {\n $this->json(['success' => false, 'error' => \"Feld '$field' ist erforderlich\"], 400);\n\n return;\n }\n }\n\n $docId = $this->repository->create([\n 'title' => trim($input['title']),\n 'slug' => trim($input['slug']),\n 'content' => $input['content'] ?? '',\n 'description' => $input['description'] ?? null,\n 'parent_id' => $input['parent_id'] ?? null,\n 'status' => $input['status'] ?? 'draft',\n 'sort_order' => $input['sort_order'] ?? 0,\n ]);\n\n $doc = $this->repository->findById($docId);\n\n $this->json([\n 'success' => true,\n 'data' => $doc,\n 'message' => 'Dokument erstellt',\n ], 201);\n } catch (\\Exception $e) {\n $this->jsonError($e->getMessage());\n }\n }\n\n \/**\n * PUT \/api\/v1\/docs\/{id}\n * Dokument aktualisieren.\n *\/\n public function update(string $id): void\n {\n try {\n $doc = $this->repository->findById((int) $id);\n\n if ($doc === null) {\n $this->json(['success' => false, 'error' => 'Dokument nicht gefunden'], 404);\n\n return;\n }\n\n $input = $this->getJsonInput();\n\n $this->repository->update((int) $id, [\n 'title' => $input['title'] ?? $doc['title'],\n 'content' => $input['content'] ?? $doc['content'],\n 'description' => $input['description'] ?? $doc['description'],\n 'status' => $input['status'] ?? $doc['status'],\n ]);\n\n $updated = $this->repository->findById((int) $id);\n\n $this->json([\n 'success' => true,\n 'data' => $updated,\n 'message' => 'Dokument aktualisiert',\n ]);\n } catch (\\Exception $e) {\n $this->jsonError($e->getMessage());\n }\n }\n\n \/**\n * DELETE \/api\/v1\/docs\/{id}\n * Dokument löschen.\n *\/\n public function destroy(string $id): void\n {\n try {\n $doc = $this->repository->findById((int) $id);\n\n if ($doc === null) {\n $this->json(['success' => false, 'error' => 'Dokument nicht gefunden'], 404);\n\n return;\n }\n\n \/\/ Check for children\n $children = $this->repository->findChildren((int) $id);\n if (!empty($children)) {\n $this->json([\n 'success' => false,\n 'error' => 'Dokument hat Unterdokumente. Lösche diese zuerst.',\n ], 400);\n\n return;",
"numLines": 100,
"startLine": 145,
"totalLines": 342
}
}
}