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,9 +4,9 @@
* Provides an in-memory storage implementation for notifications.
*/
import { Notification } from '../../domain/entities/Notification';
import type { INotificationRepository } from '../../domain/repositories/INotificationRepository';
import type { NotificationType } from '../../domain/types/NotificationTypes';
import { Notification } from '@core/notifications/domain/entities/Notification';
import type { INotificationRepository } from '@core/notifications/domain/repositories/INotificationRepository';
import type { NotificationType } from '@core/notifications/domain/types/NotificationTypes';
import type { Logger } from '@core/shared/application';
export class InMemoryNotificationRepository implements INotificationRepository {
@@ -75,7 +75,7 @@ export class InMemoryNotificationRepository implements INotificationRepository {
this.logger.info(`Found ${notifications.length} notifications for recipient ID: ${recipientId}, type: ${type}.`);
return notifications;
} catch (error) {
this.logger.error(`Error finding notifications for recipient ID ${recipientId}, type ${type}:`, error);
this.logger.error(`Error finding notifications for recipient ID ${recipientId}, type ${type}:`, error instanceof Error ? error : new Error(String(error)));
throw error;
}
}
@@ -141,7 +141,6 @@ export class InMemoryNotificationRepository implements INotificationRepository {
async deleteAllByRecipientId(recipientId: string): Promise<void> {
this.logger.debug(`Deleting all notifications for recipient ID: ${recipientId}`);
try {
const initialCount = this.notifications.size;
const toDelete = Array.from(this.notifications.values())
.filter(n => n.recipientId === recipientId)
.map(n => n.id);