This commit is contained in:
2025-12-13 11:43:09 +01:00
parent 4b6fc668b5
commit bb0497f429
38 changed files with 3838 additions and 55 deletions

View File

@@ -0,0 +1,41 @@
import type { NotificationType } from '../../domain/types/NotificationTypes';
import type { NotificationChannel } from '../../domain/types/NotificationTypes';
export interface NotificationData {
raceEventId?: string;
sessionId?: string;
leagueId?: string;
position?: number | 'DNF';
positionChange?: number;
incidents?: number;
provisionalRatingChange?: number;
finalRatingChange?: number;
hadPenaltiesApplied?: boolean;
deadline?: Date;
protestId?: string;
[key: string]: unknown;
}
export interface NotificationAction {
label: string;
type: 'primary' | 'secondary' | 'danger';
href?: string;
actionId?: string;
}
export interface SendNotificationCommand {
recipientId: string;
type: NotificationType;
title: string;
body: string;
channel: NotificationChannel;
urgency: 'silent' | 'toast' | 'modal';
data?: NotificationData;
actionUrl?: string;
actions?: NotificationAction[];
requiresResponse?: boolean;
}
export interface INotificationService {
sendNotification(command: SendNotificationCommand): Promise<void>;
}

View File

@@ -64,6 +64,8 @@ export type NotificationType =
| 'race_registration_open' // Race registration is now open
| 'race_reminder' // Race starting soon reminder
| 'race_results_posted' // Race results are available
| 'race_performance_summary' // Immediate performance summary after main race
| 'race_final_results' // Final results after stewarding closes
// League-related
| 'league_invite' // You were invited to a league
| 'league_join_request' // Someone requested to join your league
@@ -102,6 +104,8 @@ export function getNotificationTypeTitle(type: NotificationType): string {
race_registration_open: 'Registration Open',
race_reminder: 'Race Reminder',
race_results_posted: 'Results Posted',
race_performance_summary: 'Performance Summary',
race_final_results: 'Final Results',
league_invite: 'League Invitation',
league_join_request: 'Join Request',
league_join_approved: 'Request Approved',
@@ -139,6 +143,8 @@ export function getNotificationTypePriority(type: NotificationType): number {
race_registration_open: 5,
race_reminder: 8,
race_results_posted: 5,
race_performance_summary: 9, // High priority - immediate race feedback
race_final_results: 7, // Medium-high priority - final standings
league_invite: 6,
league_join_request: 5,
league_join_approved: 7,