Files
ReadMeABook/src/lib/processors/send-notification.processor.ts
T
kikootwo 89422fc77a Add authors pages and requestType notifications
Introduce full authors browsing/detail feature and enhance notifications to support type-specific titles.

- Add server APIs: authors search, author detail, and author books routes (audnexus integration) that require auth and enrich results with library matches.
- Add frontend pages/components: /authors listing and /authors/[asin] detail pages; AuthorCard, AuthorGrid, AuthorDetailCard, SimilarAuthorsRow, and related skeletons.
- Add hook and integration stubs: new useAuthors hook and audnexus-authors integration; update audible service to expose audibleBaseUrl.
- Update AudiobookDetailsModal to use audibleBaseUrl and link author names to author detail pages.
- Add header navigation link to Authors.
- Notifications: extend docs and code to include requestType (audiobook|ebook), add getEventTitle/getEventMeta helpers, update queue signature and providers/processors/tests to pass/handle requestType so titles can be resolved per request type.
- Misc: job queue, processors, provider tests and notification tests updated to reflect new behavior.

This change enables browsing authors and provides type-aware notification titles without per-provider changes.
2026-02-12 15:21:42 -05:00

51 lines
1.6 KiB
TypeScript

/**
* Component: Send Notification Job Processor
* Documentation: documentation/backend/services/notifications.md
*
* Processes notification jobs by calling NotificationService to send alerts
* to all enabled backends subscribed to the event.
*/
import { getNotificationService } from '../services/notification';
import { RMABLogger } from '../utils/logger';
import type { SendNotificationPayload } from '../services/job-queue.service';
// Re-export for consumers that import from this module
export type { SendNotificationPayload } from '../services/job-queue.service';
/**
* Process send notification job
* Calls NotificationService to send notifications to all enabled backends
*/
export async function processSendNotification(payload: SendNotificationPayload): Promise<void> {
const { event, requestId, issueId, title, author, userName, message, requestType, jobId } = payload;
const logger = RMABLogger.forJob(jobId, 'SendNotification');
logger.info(`Processing notification: ${event}`, { requestId: requestId || issueId });
try {
const notificationService = getNotificationService();
await notificationService.sendNotification({
event,
requestId,
issueId,
title,
author,
userName,
message,
requestType,
timestamp: new Date(),
});
logger.info(`Notification processed: ${event}`, { requestId });
} catch (error) {
logger.error('Failed to process notification', {
event,
requestId,
error: error instanceof Error ? error.message : String(error),
});
// Don't throw - non-blocking
}
}