This commit is contained in:
2025-12-11 13:50:38 +01:00
parent e4c1be628d
commit c7e5de40d6
212 changed files with 2965 additions and 763 deletions

View File

@@ -23,10 +23,8 @@ export type {
NotificationAction,
} from '../domain/entities/Notification';
export type { NotificationPreference, NotificationPreferenceProps, ChannelPreference, TypePreference } from '../domain/entities/NotificationPreference';
export type { NotificationType } from '../domain/value-objects/NotificationType';
export type { NotificationChannel } from '../domain/value-objects/NotificationChannel';
export { getNotificationTypeTitle, getNotificationTypePriority } from '../domain/value-objects/NotificationType';
export { getChannelDisplayName, isExternalChannel, DEFAULT_ENABLED_CHANNELS, ALL_CHANNELS } from '../domain/value-objects/NotificationChannel';
export type { NotificationType, NotificationChannel } from '../domain/types/NotificationTypes';
export { getNotificationTypeTitle, getNotificationTypePriority, getChannelDisplayName, isExternalChannel, DEFAULT_ENABLED_CHANNELS, ALL_CHANNELS } from '../domain/types/NotificationTypes';
// Re-export repository interfaces
export type { INotificationRepository } from '../domain/repositories/INotificationRepository';

View File

@@ -6,7 +6,7 @@
*/
import type { Notification } from '../../domain/entities/Notification';
import type { NotificationChannel } from '../../domain/value-objects/NotificationChannel';
import type { NotificationChannel } from '../../domain/types/NotificationTypes';
export interface NotificationDeliveryResult {
success: boolean;

View File

@@ -4,6 +4,7 @@
* Retrieves unread notifications for a recipient.
*/
import type { AsyncUseCase } from '@gridpilot/shared/application';
import type { Notification } from '../../domain/entities/Notification';
import type { INotificationRepository } from '../../domain/repositories/INotificationRepository';
@@ -12,7 +13,7 @@ export interface UnreadNotificationsResult {
totalCount: number;
}
export class GetUnreadNotificationsUseCase {
export class GetUnreadNotificationsUseCase implements AsyncUseCase<string, UnreadNotificationsResult> {
constructor(
private readonly notificationRepository: INotificationRepository,
) {}

View File

@@ -4,6 +4,7 @@
* Marks a notification as read.
*/
import type { AsyncUseCase } from '@gridpilot/shared/application';
import type { INotificationRepository } from '../../domain/repositories/INotificationRepository';
import { NotificationDomainError } from '../../domain/errors/NotificationDomainError';
@@ -12,7 +13,7 @@ export interface MarkNotificationReadCommand {
recipientId: string; // For validation
}
export class MarkNotificationReadUseCase {
export class MarkNotificationReadUseCase implements AsyncUseCase<MarkNotificationReadCommand, void> {
constructor(
private readonly notificationRepository: INotificationRepository,
) {}
@@ -42,7 +43,7 @@ export class MarkNotificationReadUseCase {
*
* Marks all notifications as read for a recipient.
*/
export class MarkAllNotificationsReadUseCase {
export class MarkAllNotificationsReadUseCase implements AsyncUseCase<string, void> {
constructor(
private readonly notificationRepository: INotificationRepository,
) {}
@@ -62,7 +63,7 @@ export interface DismissNotificationCommand {
recipientId: string;
}
export class DismissNotificationUseCase {
export class DismissNotificationUseCase implements AsyncUseCase<DismissNotificationCommand, void> {
constructor(
private readonly notificationRepository: INotificationRepository,
) {}

View File

@@ -4,16 +4,17 @@
* Manages user notification preferences.
*/
import type { AsyncUseCase } from '@gridpilot/shared/application';
import { NotificationPreference } from '../../domain/entities/NotificationPreference';
import type { ChannelPreference, TypePreference } from '../../domain/entities/NotificationPreference';
import type { INotificationPreferenceRepository } from '../../domain/repositories/INotificationPreferenceRepository';
import type { NotificationType } from '../../domain/value-objects/NotificationType';
import type { NotificationChannel } from '../../domain/value-objects/NotificationChannel';
import type { NotificationType, NotificationChannel } from '../../domain/types/NotificationTypes';
import { NotificationDomainError } from '../../domain/errors/NotificationDomainError';
/**
* Query: GetNotificationPreferencesQuery
*/
export class GetNotificationPreferencesQuery {
export class GetNotificationPreferencesQuery implements AsyncUseCase<string, NotificationPreference> {
constructor(
private readonly preferenceRepository: INotificationPreferenceRepository,
) {}
@@ -32,7 +33,7 @@ export interface UpdateChannelPreferenceCommand {
preference: ChannelPreference;
}
export class UpdateChannelPreferenceUseCase {
export class UpdateChannelPreferenceUseCase implements AsyncUseCase<UpdateChannelPreferenceCommand, void> {
constructor(
private readonly preferenceRepository: INotificationPreferenceRepository,
) {}
@@ -53,7 +54,7 @@ export interface UpdateTypePreferenceCommand {
preference: TypePreference;
}
export class UpdateTypePreferenceUseCase {
export class UpdateTypePreferenceUseCase implements AsyncUseCase<UpdateTypePreferenceCommand, void> {
constructor(
private readonly preferenceRepository: INotificationPreferenceRepository,
) {}
@@ -74,7 +75,7 @@ export interface UpdateQuietHoursCommand {
endHour: number | undefined;
}
export class UpdateQuietHoursUseCase {
export class UpdateQuietHoursUseCase implements AsyncUseCase<UpdateQuietHoursCommand, void> {
constructor(
private readonly preferenceRepository: INotificationPreferenceRepository,
) {}
@@ -103,7 +104,7 @@ export interface SetDigestModeCommand {
frequencyHours?: number;
}
export class SetDigestModeUseCase {
export class SetDigestModeUseCase implements AsyncUseCase<SetDigestModeCommand, void> {
constructor(
private readonly preferenceRepository: INotificationPreferenceRepository,
) {}

View File

@@ -6,13 +6,13 @@
*/
import { v4 as uuid } from 'uuid';
import type { AsyncUseCase } from '@gridpilot/shared/application';
import { Notification } from '../../domain/entities/Notification';
import type { NotificationData } from '../../domain/entities/Notification';
import type { INotificationRepository } from '../../domain/repositories/INotificationRepository';
import type { INotificationPreferenceRepository } from '../../domain/repositories/INotificationPreferenceRepository';
import type { INotificationGatewayRegistry, NotificationDeliveryResult } from '../ports/INotificationGateway';
import type { NotificationType } from '../../domain/value-objects/NotificationType';
import type { NotificationChannel } from '../../domain/value-objects/NotificationChannel';
import type { NotificationType, NotificationChannel } from '../../domain/types/NotificationTypes';
export interface SendNotificationCommand {
recipientId: string;
@@ -43,7 +43,7 @@ export interface SendNotificationResult {
deliveryResults: NotificationDeliveryResult[];
}
export class SendNotificationUseCase {
export class SendNotificationUseCase implements AsyncUseCase<SendNotificationCommand, SendNotificationResult> {
constructor(
private readonly notificationRepository: INotificationRepository,
private readonly preferenceRepository: INotificationPreferenceRepository,