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]>
29 lines
614 B
PHP
29 lines
614 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Modules\Catalog\Domain\ValueObjects;
|
|
|
|
use App\Modules\Catalog\Domain\Exceptions\InvalidCatalogName;
|
|
|
|
/**
|
|
* Name of a service unit, service or work type, e.g. "Videotuotanto".
|
|
*/
|
|
final readonly class CatalogName
|
|
{
|
|
public const int MAX_LENGTH = 100;
|
|
|
|
public string $value;
|
|
|
|
public function __construct(string $value)
|
|
{
|
|
$value = trim(preg_replace('/\s+/u', ' ', $value) ?? $value);
|
|
|
|
if ($value === '' || mb_strlen($value) > self::MAX_LENGTH) {
|
|
throw new InvalidCatalogName;
|
|
}
|
|
|
|
$this->value = $value;
|
|
}
|
|
}
|