mirror of
https://github.com/kikootwo/ReadMeABook.git
synced 2026-06-03 04:40:09 +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.
62 lines
1.5 KiB
TypeScript
62 lines
1.5 KiB
TypeScript
/**
|
|
* Component: Audiobook Details API Route
|
|
* Documentation: documentation/integrations/audible.md
|
|
*/
|
|
|
|
import { NextRequest, NextResponse } from 'next/server';
|
|
import { getAudibleService } from '@/lib/integrations/audible.service';
|
|
import { RMABLogger } from '@/lib/utils/logger';
|
|
|
|
const logger = RMABLogger.create('API.Audiobooks.Details');
|
|
|
|
/**
|
|
* GET /api/audiobooks/[asin]
|
|
* Get detailed information for a specific audiobook
|
|
*/
|
|
export async function GET(
|
|
request: NextRequest,
|
|
{ params }: { params: Promise<{ asin: string }> }
|
|
) {
|
|
try {
|
|
const { asin } = await params;
|
|
|
|
if (!asin || asin.length !== 10) {
|
|
return NextResponse.json(
|
|
{
|
|
error: 'ValidationError',
|
|
message: 'Valid ASIN is required',
|
|
},
|
|
{ status: 400 }
|
|
);
|
|
}
|
|
|
|
const audibleService = getAudibleService();
|
|
const audiobook = await audibleService.getAudiobookDetails(asin);
|
|
|
|
if (!audiobook) {
|
|
return NextResponse.json(
|
|
{
|
|
error: 'NotFound',
|
|
message: 'Audiobook not found',
|
|
},
|
|
{ status: 404 }
|
|
);
|
|
}
|
|
|
|
return NextResponse.json({
|
|
success: true,
|
|
audiobook,
|
|
audibleBaseUrl: audibleService.getBaseUrl(),
|
|
});
|
|
} catch (error) {
|
|
logger.error('Failed to get audiobook details', { error: error instanceof Error ? error.message : String(error) });
|
|
return NextResponse.json(
|
|
{
|
|
error: 'FetchError',
|
|
message: 'Failed to fetch audiobook details',
|
|
},
|
|
{ status: 500 }
|
|
);
|
|
}
|
|
}
|