Add catalog module for service units, services and work types

Phase 1, item 3: the hierarchy customer jobs, tasks and time entries
will refer to.

- New Catalog module: service unit > optional service > work type.
  Names are unique per level (case-insensitive); items are never
  deleted, only deactivated, and foreign keys restrict deletes.
- Pohjatiedot page (/catalog, admins and management): add, rename,
  reorder with move up/down buttons (keyboard-friendly, focus kept and
  announced) and an "in use" checkbox per row. Work types can move to
  another service of the same unit.
- A migration inserts the starting catalog from the specification when
  the tables are empty, so every installation has it.
- CatalogQueries gives other modules the active service units and the
  work types of chosen units plus the shared ones.
- Spec and CLAUDE.md updated.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-11-23 18:27:58 +02:00
co-authored by Claude Opus 5.5
parent e0b8f4970f
commit 51b2d4a252
62 changed files with 3196 additions and 7 deletions
@@ -0,0 +1,53 @@
<?php
declare(strict_types=1);
namespace App\Modules\Catalog\Application\Contracts;
use App\Modules\Catalog\Application\DTOs\ServiceSummary;
use App\Modules\Catalog\Application\DTOs\ServiceUnitNode;
use App\Modules\Catalog\Application\DTOs\ServiceUnitSummary;
use App\Modules\Catalog\Application\DTOs\WorkTypeSummary;
/**
* Read side of the catalog. Other modules (customer jobs, tasks, time
* entries) use this contract, never the module's Eloquent models.
*/
interface CatalogQueries
{
/**
* The whole hierarchy in order, for the catalog management page.
*
* @return list<ServiceUnitNode>
*/
public function tree(bool $includeInactive = true): array;
/**
* Active service units a customer job can be assigned to (not the shared unit).
*
* @return list<ServiceUnitSummary>
*/
public function activeServiceUnits(): array;
/**
* Active work types of the given service units plus the shared work
* types, grouped by unit and service.
*
* @param list<int> $serviceUnitIds
* @return list<ServiceUnitNode>
*/
public function activeWorkTypesFor(array $serviceUnitIds): array;
public function findServiceUnit(int $id): ?ServiceUnitSummary;
public function findService(int $id): ?ServiceSummary;
public function findWorkType(int $id): ?WorkTypeSummary;
/**
* The services of a unit in order, for choosing a work type's service.
*
* @return list<ServiceSummary>
*/
public function servicesOf(int $serviceUnitId): array;
}