feat: complete jobcard management workflows and UI
This commit is contained in:
@@ -35,7 +35,7 @@ final class NotificationRecord
|
||||
];
|
||||
}
|
||||
|
||||
/** Validate the command used by a user to mark one notification read. */
|
||||
/** Validate the command used by a user to change one notification's read state. */
|
||||
public function validateMarkRead(array $command): array
|
||||
{
|
||||
$value = $command['notification_id'] ?? $command['id'] ?? null;
|
||||
@@ -46,6 +46,12 @@ final class NotificationRecord
|
||||
return ['valid' => $errors === [], 'notification_id' => $notificationId, 'errors' => $errors];
|
||||
}
|
||||
|
||||
/** Alias with an explicit command name for callers that mark notifications unread. */
|
||||
public function validateMarkUnread(array $command): array
|
||||
{
|
||||
return $this->validateMarkRead($command);
|
||||
}
|
||||
|
||||
/** Return one normalized queue DTO for a single recipient. */
|
||||
public function toQueueDto(array $record, string $recipient): array
|
||||
{
|
||||
@@ -136,6 +142,8 @@ final class NotificationRecord
|
||||
return [
|
||||
'type' => $normalized['type'],
|
||||
'recipients' => $normalized['recipients'],
|
||||
'title' => is_scalar($record['title'] ?? null) ? trim((string) $record['title']) : '',
|
||||
'body' => is_scalar($record['body'] ?? null) && trim((string) $record['body']) !== '' ? trim((string) $record['body']) : null,
|
||||
'is_read' => $normalized['is_read'],
|
||||
'deduplication_key' => $normalized['deduplication_key'],
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user