Backup #623

ID623
Dateipfad/var/www/dev.campus.systemische-tools.de/src/Controller/Api/ContentController.php
Version2
Typ modified
Größe1.7 KB
Hash17acaf2f0cf8e952d939f83aefab94eb85e72be9a8d7b66f2cde4eec618092c8
Datum2025-12-23 04:43:14
Geändert vonclaude-code-hook
GrundClaude Code Pre-Hook Backup vor Edit-Operation
Datei existiert Ja

Dateiinhalt

<?php

namespace Controller\Api;

use Framework\Controller;
use Infrastructure\Persistence\ContentRepository;

class ContentController extends Controller
{
    private ContentRepository $repository;

    public function __construct(?ContentRepository $repository = null)
    {
        $this->repository = $repository ?? new ContentRepository();
    }

    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());
        }
    }
}

Vollständig herunterladen

Aktionen

Herunterladen

Andere Versionen dieser Datei

ID Version Typ Größe Datum
2067 6 modified 2.4 KB 2025-12-28 23:30
1672 5 modified 1.8 KB 2025-12-27 11:43
1274 4 modified 1.8 KB 2025-12-25 12:52
701 3 modified 1.7 KB 2025-12-23 07:53
623 2 modified 1.7 KB 2025-12-23 04:43
592 1 modified 1.7 KB 2025-12-23 04:25

← Zurück zur Übersicht