fix issues in adapters

This commit is contained in:
2025-12-22 22:46:15 +01:00
parent 41b27402dc
commit 1efd971032
25 changed files with 144 additions and 103 deletions

View File

@@ -4,31 +4,31 @@
* Manages notification gateways and routes notifications to appropriate channels.
*/
import type { Notification } from '../../domain/entities/Notification';
import type { NotificationChannel } from '../../domain/types/NotificationTypes';
import type {
INotificationGateway,
INotificationGatewayRegistry,
NotificationDeliveryResult
} from '../../application/ports/INotificationGateway';
import type { Notification } from '@core/notifications/domain/entities/Notification';
import type { NotificationChannel } from '@core/notifications/domain/types/NotificationTypes';
import type {
NotificationGateway,
NotificationGatewayRegistry as INotificationGatewayRegistry,
NotificationDeliveryResult
} from '@core/notifications/application/ports/NotificationGateway';
export class NotificationGatewayRegistry implements INotificationGatewayRegistry {
private gateways: Map<NotificationChannel, INotificationGateway> = new Map();
private gateways: Map<NotificationChannel, NotificationGateway> = new Map();
constructor(initialGateways: INotificationGateway[] = []) {
constructor(initialGateways: NotificationGateway[] = []) {
initialGateways.forEach(gateway => this.register(gateway));
}
register(gateway: INotificationGateway): void {
register(gateway: NotificationGateway): void {
const channel = gateway.getChannel();
this.gateways.set(channel, gateway);
}
getGateway(channel: NotificationChannel): INotificationGateway | null {
getGateway(channel: NotificationChannel): NotificationGateway | null {
return this.gateways.get(channel) || null;
}
getAllGateways(): INotificationGateway[] {
getAllGateways(): NotificationGateway[] {
return Array.from(this.gateways.values());
}