feat: add book transcripts categorisation
This commit is contained in:
@@ -59,6 +59,12 @@ export type PlaceGroup = {
|
||||
count: number;
|
||||
};
|
||||
|
||||
export type BookGroup = {
|
||||
code: string;
|
||||
title: string;
|
||||
count: number;
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// BFF response types (snake_case from Go)
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -185,6 +191,16 @@ export async function getTranscriptionPlaces(): Promise<PlaceGroup[]> {
|
||||
.sort((a, b) => b.count - a.count);
|
||||
}
|
||||
|
||||
export async function getTranscriptionBooks(): Promise<BookGroup[]> {
|
||||
const raw = await bffList<{ _id: string; title: string; count: number }>(
|
||||
"/transcriptions/books",
|
||||
{ tags: ["transcriptions"] },
|
||||
);
|
||||
return raw
|
||||
.map((item) => ({ code: item._id, title: item.title, count: item.count }))
|
||||
.sort((a, b) => b.count - a.count);
|
||||
}
|
||||
|
||||
export async function getTotalTranscriptionCount(): Promise<number> {
|
||||
const res = await bff<{ count: number }>("/transcriptions", {
|
||||
tags: ["transcriptions"],
|
||||
@@ -248,6 +264,16 @@ export async function getTranscriptionsByType(
|
||||
return raw.map(mapSummary);
|
||||
}
|
||||
|
||||
export async function getTranscriptionsByBook(
|
||||
code: string,
|
||||
): Promise<TranscriptionSummary[]> {
|
||||
const raw = await bffList<BffSummary>(
|
||||
`/transcriptions/book/${encodeURIComponent(code)}`,
|
||||
{ tags: ["transcriptions"] },
|
||||
);
|
||||
return raw.map(mapSummary);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Single transcription
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user