wip
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* Value Object: NotificationChannel
|
||||
*
|
||||
* Defines the delivery channels for notifications.
|
||||
*/
|
||||
|
||||
export type NotificationChannel =
|
||||
| 'in_app' // In-app notification (stored in database, shown in UI)
|
||||
| 'email' // Email notification
|
||||
| 'discord' // Discord webhook notification
|
||||
| 'push'; // Push notification (future: mobile/browser)
|
||||
|
||||
/**
|
||||
* Get human-readable name for channel
|
||||
*/
|
||||
export function getChannelDisplayName(channel: NotificationChannel): string {
|
||||
const names: Record<NotificationChannel, string> = {
|
||||
in_app: 'In-App',
|
||||
email: 'Email',
|
||||
discord: 'Discord',
|
||||
push: 'Push Notification',
|
||||
};
|
||||
return names[channel];
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if channel requires external integration
|
||||
*/
|
||||
export function isExternalChannel(channel: NotificationChannel): boolean {
|
||||
return channel !== 'in_app';
|
||||
}
|
||||
|
||||
/**
|
||||
* Default channels that are always enabled
|
||||
*/
|
||||
export const DEFAULT_ENABLED_CHANNELS: NotificationChannel[] = ['in_app'];
|
||||
|
||||
/**
|
||||
* All available channels
|
||||
*/
|
||||
export const ALL_CHANNELS: NotificationChannel[] = ['in_app', 'email', 'discord', 'push'];
|
||||
@@ -0,0 +1,97 @@
|
||||
/**
|
||||
* Value Object: NotificationType
|
||||
*
|
||||
* Defines the types of notifications that can be sent in the system.
|
||||
*/
|
||||
|
||||
export type NotificationType =
|
||||
// Protest-related
|
||||
| 'protest_filed' // A protest was filed against you
|
||||
| 'protest_defense_requested' // Steward requests your defense
|
||||
| 'protest_defense_submitted' // Accused submitted their defense
|
||||
| 'protest_comment_added' // New comment on a protest you're involved in
|
||||
| 'protest_vote_required' // You need to vote on a protest
|
||||
| 'protest_vote_cast' // Someone voted on a protest
|
||||
| 'protest_resolved' // Protest has been resolved
|
||||
// Penalty-related
|
||||
| 'penalty_issued' // A penalty was issued to you
|
||||
| 'penalty_appealed' // Penalty appeal submitted
|
||||
| 'penalty_appeal_resolved' // Appeal was resolved
|
||||
// Race-related
|
||||
| 'race_registration_open' // Race registration is now open
|
||||
| 'race_reminder' // Race starting soon reminder
|
||||
| 'race_results_posted' // Race results are available
|
||||
// League-related
|
||||
| 'league_invite' // You were invited to a league
|
||||
| 'league_join_request' // Someone requested to join your league
|
||||
| 'league_join_approved' // Your join request was approved
|
||||
| 'league_join_rejected' // Your join request was rejected
|
||||
| 'league_role_changed' // Your role in a league changed
|
||||
// Team-related
|
||||
| 'team_invite' // You were invited to a team
|
||||
| 'team_join_request' // Someone requested to join your team
|
||||
| 'team_join_approved' // Your team join request was approved
|
||||
// System
|
||||
| 'system_announcement'; // System-wide announcement
|
||||
|
||||
/**
|
||||
* Get human-readable title for notification type
|
||||
*/
|
||||
export function getNotificationTypeTitle(type: NotificationType): string {
|
||||
const titles: Record<NotificationType, string> = {
|
||||
protest_filed: 'Protest Filed',
|
||||
protest_defense_requested: 'Defense Requested',
|
||||
protest_defense_submitted: 'Defense Submitted',
|
||||
protest_comment_added: 'New Comment',
|
||||
protest_vote_required: 'Vote Required',
|
||||
protest_vote_cast: 'Vote Cast',
|
||||
protest_resolved: 'Protest Resolved',
|
||||
penalty_issued: 'Penalty Issued',
|
||||
penalty_appealed: 'Penalty Appealed',
|
||||
penalty_appeal_resolved: 'Appeal Resolved',
|
||||
race_registration_open: 'Registration Open',
|
||||
race_reminder: 'Race Reminder',
|
||||
race_results_posted: 'Results Posted',
|
||||
league_invite: 'League Invitation',
|
||||
league_join_request: 'Join Request',
|
||||
league_join_approved: 'Request Approved',
|
||||
league_join_rejected: 'Request Rejected',
|
||||
league_role_changed: 'Role Changed',
|
||||
team_invite: 'Team Invitation',
|
||||
team_join_request: 'Team Join Request',
|
||||
team_join_approved: 'Team Request Approved',
|
||||
system_announcement: 'Announcement',
|
||||
};
|
||||
return titles[type];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get priority level for notification type (higher = more urgent)
|
||||
*/
|
||||
export function getNotificationTypePriority(type: NotificationType): number {
|
||||
const priorities: Record<NotificationType, number> = {
|
||||
protest_filed: 8,
|
||||
protest_defense_requested: 9,
|
||||
protest_defense_submitted: 6,
|
||||
protest_comment_added: 4,
|
||||
protest_vote_required: 8,
|
||||
protest_vote_cast: 3,
|
||||
protest_resolved: 7,
|
||||
penalty_issued: 9,
|
||||
penalty_appealed: 7,
|
||||
penalty_appeal_resolved: 7,
|
||||
race_registration_open: 5,
|
||||
race_reminder: 8,
|
||||
race_results_posted: 5,
|
||||
league_invite: 6,
|
||||
league_join_request: 5,
|
||||
league_join_approved: 7,
|
||||
league_join_rejected: 7,
|
||||
league_role_changed: 6,
|
||||
team_invite: 5,
|
||||
team_join_request: 4,
|
||||
team_join_approved: 6,
|
||||
system_announcement: 10,
|
||||
};
|
||||
return priorities[type];
|
||||
}
|
||||
Reference in New Issue
Block a user