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,19 @@
<?php
declare(strict_types=1);
namespace App\Modules\Catalog\Application\DTOs;
/**
* A service with its work types, in order.
*/
final readonly class ServiceNode
{
/**
* @param list<WorkTypeSummary> $workTypes
*/
public function __construct(
public ServiceSummary $service,
public array $workTypes,
) {}
}
@@ -0,0 +1,15 @@
<?php
declare(strict_types=1);
namespace App\Modules\Catalog\Application\DTOs;
final readonly class ServiceSummary
{
public function __construct(
public int $id,
public int $serviceUnitId,
public string $name,
public bool $isActive,
) {}
}
@@ -0,0 +1,22 @@
<?php
declare(strict_types=1);
namespace App\Modules\Catalog\Application\DTOs;
/**
* A service unit with its services and the work types directly under it,
* in order.
*/
final readonly class ServiceUnitNode
{
/**
* @param list<ServiceNode> $services
* @param list<WorkTypeSummary> $workTypes Work types under no service.
*/
public function __construct(
public ServiceUnitSummary $serviceUnit,
public array $services,
public array $workTypes,
) {}
}
@@ -0,0 +1,15 @@
<?php
declare(strict_types=1);
namespace App\Modules\Catalog\Application\DTOs;
final readonly class ServiceUnitSummary
{
public function __construct(
public int $id,
public string $name,
public bool $isShared,
public bool $isActive,
) {}
}
@@ -0,0 +1,16 @@
<?php
declare(strict_types=1);
namespace App\Modules\Catalog\Application\DTOs;
final readonly class WorkTypeSummary
{
public function __construct(
public int $id,
public int $serviceUnitId,
public ?int $serviceId,
public string $name,
public bool $isActive,
) {}
}