feat: add book transcripts categorisation

This commit is contained in:
gosangam
2026-06-17 12:40:40 +05:30
parent f96e7dd2f1
commit f5abe33c09
7 changed files with 930 additions and 10 deletions
+26
View File
@@ -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
// ---------------------------------------------------------------------------