feat: complete Epic 0 — foundation migration & infrastructure setup

Stories 0.2-0.5: rename folders→declarations (backend+frontend), configure
Redis for cache/queue/sessions, add foundation database migrations
(permissions, archived_at), replace DeclarationStatus enum with architecture
lifecycle values, create DeclarationObserver for status transition validation
and auto-archive, fix controller status transitions to respect observer rules.

93 tests pass (240 assertions).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-12 18:25:32 +00:00
parent d380df4074
commit fd43a6f429
105 changed files with 3899 additions and 1558 deletions

View File

@@ -141,7 +141,7 @@ class ClientController extends Controller
$client->load(['internalResponsible', 'contacts']);
$folders = $client->folders()
$declarations = $client->declarations()
->with(['assignee'])
->latest()
->limit(50)
@@ -153,18 +153,18 @@ class ClientController extends Controller
'status' => $f->status->value,
'due_date' => $f->due_date?->format('Y-m-d'),
'created_at' => $f->created_at->format('Y-m-d'),
'showUrl' => route('folders.show', $f),
'showUrl' => route('declarations.show', $f),
])
->values()
->all();
$allFolders = $client->folders()->get();
$allDeclarations = $client->declarations()->get();
$stats = [
'total' => $allFolders->count(),
'by_status' => $allFolders->groupBy(fn ($f) => $f->status->value)
'total' => $allDeclarations->count(),
'by_status' => $allDeclarations->groupBy(fn ($f) => $f->status->value)
->map->count()
->all(),
'by_type' => $allFolders->groupBy(fn ($f) => $f->type->value)
'by_type' => $allDeclarations->groupBy(fn ($f) => $f->type->value)
->map->count()
->all(),
];
@@ -185,11 +185,11 @@ class ClientController extends Controller
'status' => $client->status?->value,
'internal_notes' => $client->internal_notes,
],
'folders' => $folders,
'declarations' => $declarations,
'stats' => $stats,
'indexUrl' => route('clients.index'),
'editUrl' => route('clients.edit', $client),
'createFolderUrl' => route('folders.create', ['client_id' => $client->id]),
'createDeclarationUrl' => route('declarations.create', ['client_id' => $client->id]),
]);
}