fix issues in adapters
This commit is contained in:
@@ -1,27 +1,34 @@
|
||||
/**
|
||||
* Infrastructure Adapter: InAppNotificationAdapter
|
||||
* Infrastructure Adapter: InAppNotificationAdapter (Stub)
|
||||
*
|
||||
* Handles in-app notifications (stored in database, shown in UI).
|
||||
* This is the primary/default notification channel.
|
||||
* Handles in-app notifications.
|
||||
* Currently a stub - to be implemented when in-app notification system is needed.
|
||||
*/
|
||||
|
||||
import type { Notification } from '../../domain/entities/Notification';
|
||||
import type { Notification } from '@core/notifications/domain/entities/Notification';
|
||||
import type {
|
||||
INotificationGateway,
|
||||
NotificationGateway,
|
||||
NotificationDeliveryResult
|
||||
} from '../../application/ports/INotificationGateway';
|
||||
import type { NotificationChannel } from '../../domain/types/NotificationTypes';
|
||||
} from '@core/notifications/application/ports/NotificationGateway';
|
||||
import type { NotificationChannel } from '@core/notifications/domain/types/NotificationTypes';
|
||||
|
||||
export class InAppNotificationAdapter implements INotificationGateway {
|
||||
export class InAppNotificationAdapter implements NotificationGateway {
|
||||
private readonly channel: NotificationChannel = 'in_app';
|
||||
|
||||
/**
|
||||
* For in_app, sending is essentially a no-op since the notification
|
||||
* is already persisted by the use case. This just confirms delivery.
|
||||
*/
|
||||
constructor() {
|
||||
// In-app notifications don't need external configuration
|
||||
}
|
||||
|
||||
async send(notification: Notification): Promise<NotificationDeliveryResult> {
|
||||
// In-app notifications are stored directly in the repository
|
||||
// This adapter just confirms the "delivery" was successful
|
||||
// In-app notifications are stored in the database, so this is a stub
|
||||
// that simulates successful delivery
|
||||
console.log(`[InApp Stub] Notification stored in database:`, {
|
||||
id: notification.id,
|
||||
recipientId: notification.recipientId,
|
||||
title: notification.title,
|
||||
body: notification.body,
|
||||
});
|
||||
|
||||
return {
|
||||
success: true,
|
||||
channel: this.channel,
|
||||
@@ -35,7 +42,8 @@ export class InAppNotificationAdapter implements INotificationGateway {
|
||||
}
|
||||
|
||||
isConfigured(): boolean {
|
||||
return true; // Always configured
|
||||
// In-app notifications are always configured
|
||||
return true;
|
||||
}
|
||||
|
||||
getChannel(): NotificationChannel {
|
||||
|
||||
Reference in New Issue
Block a user