mirror of
https://github.com/kikootwo/ReadMeABook.git
synced 2026-06-13 09:40:11 +00:00
89422fc77a
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.
59 lines
1.7 KiB
TypeScript
59 lines
1.7 KiB
TypeScript
/**
|
|
* Notification Provider Interface
|
|
* Documentation: documentation/backend/services/notifications.md
|
|
*/
|
|
|
|
// Re-export event types from central source of truth
|
|
export type { NotificationEvent } from '@/lib/constants/notification-events';
|
|
|
|
// Backend type — string-based, registry is the runtime source of truth
|
|
export type NotificationBackendType = string;
|
|
|
|
// Notification payload
|
|
export interface NotificationPayload {
|
|
event: import('@/lib/constants/notification-events').NotificationEvent;
|
|
requestId?: string;
|
|
issueId?: string;
|
|
title: string;
|
|
author: string;
|
|
userName: string;
|
|
message?: string; // For error/issue events
|
|
requestType?: string; // 'audiobook' | 'ebook' — drives type-specific titles via getEventTitle()
|
|
timestamp: Date;
|
|
}
|
|
|
|
// Provider config field definition for dynamic UI rendering
|
|
export interface ProviderConfigField {
|
|
name: string;
|
|
label: string;
|
|
type: 'text' | 'password' | 'select' | 'number';
|
|
required: boolean;
|
|
placeholder?: string;
|
|
defaultValue?: string | number;
|
|
options?: { label: string; value: string | number }[];
|
|
}
|
|
|
|
// Provider metadata for self-describing providers
|
|
export interface ProviderMetadata {
|
|
type: string;
|
|
displayName: string;
|
|
description: string;
|
|
iconLabel: string;
|
|
iconColor: string;
|
|
configFields: ProviderConfigField[];
|
|
}
|
|
|
|
export interface INotificationProvider {
|
|
/** Provider identifier */
|
|
type: string;
|
|
|
|
/** Config field names that need encryption/masking */
|
|
sensitiveFields: string[];
|
|
|
|
/** Self-describing metadata for UI and validation */
|
|
metadata: ProviderMetadata;
|
|
|
|
/** Send notification with already-decrypted config */
|
|
send(config: Record<string, any>, payload: NotificationPayload): Promise<void>;
|
|
}
|