50 lines
1.3 KiB
TypeScript
50 lines
1.3 KiB
TypeScript
/**
|
|
* Data access layer for Perfect Questions, Perfect Answers (PQPA).
|
|
*
|
|
* Delegates to the generic book data layer which calls the BFF API.
|
|
*/
|
|
|
|
import {
|
|
getBookMeta,
|
|
getIntroSegments,
|
|
getIntroSegment,
|
|
getChapter,
|
|
getContent,
|
|
getSidebarItems,
|
|
type BookMeta,
|
|
type IntroSegment,
|
|
type Chapter,
|
|
type SidebarItem,
|
|
} from "@/lib/books";
|
|
|
|
const CODE = "pqpa";
|
|
|
|
export type PqpaMeta = BookMeta;
|
|
export type PqpaChapterEntry = { number: number; title: string };
|
|
export type PqpaIntroSegment = IntroSegment;
|
|
export type PqpaChapter = Chapter;
|
|
export type PqpaSidebarItem = SidebarItem;
|
|
|
|
export async function getPqpaMeta() {
|
|
return getBookMeta(CODE);
|
|
}
|
|
export async function getPqpaIntroSegments() {
|
|
return getIntroSegments(CODE);
|
|
}
|
|
export async function getPqpaIntroSegment(slug: string) {
|
|
return getIntroSegment(CODE, slug);
|
|
}
|
|
export async function getPqpaChapter(chapterNum: number) {
|
|
return getChapter(CODE, String(chapterNum));
|
|
}
|
|
// PqpaConcludingWords is just a chapter with slug "concluding-words"
|
|
export async function getPqpaConcludingWords() {
|
|
return getChapter(CODE, "concluding-words");
|
|
}
|
|
export async function getPqpaContent(slug: string) {
|
|
return getContent(CODE, slug);
|
|
}
|
|
export async function getPqpaSidebarItems() {
|
|
return getSidebarItems(CODE);
|
|
}
|