mirror of
https://github.com/kikootwo/ReadMeABook.git
synced 2026-06-03 04:40:09 +00:00
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.
This commit is contained in:
@@ -155,6 +155,7 @@ export interface SendNotificationPayload extends JobPayload {
|
||||
author: string;
|
||||
userName: string;
|
||||
message?: string;
|
||||
requestType?: string; // 'audiobook' | 'ebook' — drives type-specific notification titles
|
||||
timestamp: Date;
|
||||
}
|
||||
|
||||
@@ -948,7 +949,8 @@ export class JobQueueService {
|
||||
title: string,
|
||||
author: string,
|
||||
userName: string,
|
||||
message?: string
|
||||
message?: string,
|
||||
requestType?: string
|
||||
): Promise<string> {
|
||||
logger.info(`Queueing notification: ${event}`, { requestId, title, userName });
|
||||
return await this.addJob(
|
||||
@@ -963,6 +965,7 @@ export class JobQueueService {
|
||||
author,
|
||||
userName,
|
||||
message,
|
||||
requestType,
|
||||
// Pass the original ID for notification display (e.g., Discord footer)
|
||||
...(event === 'issue_reported' && { issueId: requestId }),
|
||||
timestamp: new Date(),
|
||||
|
||||
@@ -18,6 +18,7 @@ export interface NotificationPayload {
|
||||
author: string;
|
||||
userName: string;
|
||||
message?: string; // For error/issue events
|
||||
requestType?: string; // 'audiobook' | 'ebook' — drives type-specific titles via getEventTitle()
|
||||
timestamp: Date;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
|
||||
import { INotificationProvider, NotificationPayload, ProviderMetadata } from '../INotificationProvider';
|
||||
import { getEventMeta, type NotificationSeverity } from '@/lib/constants/notification-events';
|
||||
import { getEventMeta, getEventTitle, type NotificationSeverity } from '@/lib/constants/notification-events';
|
||||
|
||||
export interface AppriseConfig {
|
||||
serverUrl: string;
|
||||
@@ -108,8 +108,7 @@ export class AppriseProvider implements INotificationProvider {
|
||||
}
|
||||
|
||||
private formatMessage(payload: NotificationPayload): { title: string; body: string } {
|
||||
const { event, title, author, userName, message } = payload;
|
||||
const meta = getEventMeta(event);
|
||||
const { event, title, author, userName, message, requestType } = payload;
|
||||
|
||||
const isIssue = event === 'issue_reported';
|
||||
const messageLines = [
|
||||
@@ -123,7 +122,7 @@ export class AppriseProvider implements INotificationProvider {
|
||||
}
|
||||
|
||||
return {
|
||||
title: meta.title,
|
||||
title: getEventTitle(event, requestType),
|
||||
body: messageLines.join('\n'),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
|
||||
import { INotificationProvider, NotificationPayload, ProviderMetadata } from '../INotificationProvider';
|
||||
import { getEventMeta, type NotificationSeverity } from '@/lib/constants/notification-events';
|
||||
import { getEventMeta, getEventTitle, type NotificationSeverity } from '@/lib/constants/notification-events';
|
||||
|
||||
export interface DiscordConfig {
|
||||
webhookUrl: string;
|
||||
@@ -59,8 +59,9 @@ export class DiscordProvider implements INotificationProvider {
|
||||
}
|
||||
|
||||
private formatEmbed(payload: NotificationPayload): any {
|
||||
const { event, title, author, userName, message, requestId, timestamp } = payload;
|
||||
const { event, title, author, userName, message, requestId, requestType, timestamp } = payload;
|
||||
const meta = getEventMeta(event);
|
||||
const resolvedTitle = getEventTitle(event, requestType);
|
||||
|
||||
const isIssue = event === 'issue_reported';
|
||||
const fields = [
|
||||
@@ -74,7 +75,7 @@ export class DiscordProvider implements INotificationProvider {
|
||||
}
|
||||
|
||||
return {
|
||||
title: `${meta.emoji} ${meta.title}`,
|
||||
title: `${meta.emoji} ${resolvedTitle}`,
|
||||
color: SEVERITY_COLORS[meta.severity],
|
||||
fields,
|
||||
footer: {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
|
||||
import { INotificationProvider, NotificationPayload, ProviderMetadata } from '../INotificationProvider';
|
||||
import { getEventMeta, type NotificationSeverity, type NotificationPriority } from '@/lib/constants/notification-events';
|
||||
import { getEventMeta, getEventTitle, type NotificationSeverity, type NotificationPriority } from '@/lib/constants/notification-events';
|
||||
|
||||
export interface NtfyConfig {
|
||||
serverUrl?: string;
|
||||
@@ -83,8 +83,7 @@ export class NtfyProvider implements INotificationProvider {
|
||||
}
|
||||
|
||||
private formatMessage(payload: NotificationPayload): { title: string; message: string } {
|
||||
const { event, title, author, userName, message } = payload;
|
||||
const meta = getEventMeta(event);
|
||||
const { event, title, author, userName, message, requestType } = payload;
|
||||
|
||||
const isIssue = event === 'issue_reported';
|
||||
const messageLines = [
|
||||
@@ -98,7 +97,7 @@ export class NtfyProvider implements INotificationProvider {
|
||||
}
|
||||
|
||||
return {
|
||||
title: meta.title,
|
||||
title: getEventTitle(event, requestType),
|
||||
message: messageLines.join('\n'),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
|
||||
import { INotificationProvider, NotificationPayload, ProviderMetadata } from '../INotificationProvider';
|
||||
import { getEventMeta, type NotificationPriority } from '@/lib/constants/notification-events';
|
||||
import { getEventMeta, getEventTitle, type NotificationPriority } from '@/lib/constants/notification-events';
|
||||
|
||||
export interface PushoverConfig {
|
||||
userKey: string;
|
||||
@@ -77,12 +77,13 @@ export class PushoverProvider implements INotificationProvider {
|
||||
}
|
||||
|
||||
private formatMessage(payload: NotificationPayload): { title: string; message: string } {
|
||||
const { event, title, author, userName, message } = payload;
|
||||
const { event, title, author, userName, message, requestType } = payload;
|
||||
const meta = getEventMeta(event);
|
||||
const resolvedTitle = getEventTitle(event, requestType);
|
||||
|
||||
const isIssue = event === 'issue_reported';
|
||||
const messageLines = [
|
||||
`${meta.emoji} ${meta.title}`,
|
||||
`${meta.emoji} ${resolvedTitle}`,
|
||||
'',
|
||||
`\u{1F4DA} ${title}`,
|
||||
`\u270D\uFE0F ${author}`,
|
||||
@@ -94,7 +95,7 @@ export class PushoverProvider implements INotificationProvider {
|
||||
}
|
||||
|
||||
return {
|
||||
title: meta.title,
|
||||
title: resolvedTitle,
|
||||
message: messageLines.join('\n'),
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user