-
Notifications
You must be signed in to change notification settings - Fork 11
/
index.ts
40 lines (37 loc) · 1.06 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { loadSeriesPage } from "src/page-loaders";
import { Series } from "types/entities";
import {
getSeriesAuthors,
getSeriesBookmarkCount,
getSeriesCompletionStatus,
getSeriesDescription,
getSeriesNotes,
getSeriesPublishDate,
getSeriesTitle,
getSeriesUpdateDate,
getSeriesWordCount,
getSeriesWorkCount,
getSeriesWorks,
} from "./getters";
export const getSeries = async ({
seriesId,
}: {
seriesId: string;
}): Promise<Series> => {
const seriesPage = await loadSeriesPage(seriesId);
const seriesWorks = getSeriesWorks(seriesPage);
return {
id: seriesId,
name: getSeriesTitle(seriesPage),
startedAt: getSeriesPublishDate(seriesPage),
updatedAt: getSeriesUpdateDate(seriesPage),
authors: getSeriesAuthors(seriesPage),
description: getSeriesDescription(seriesPage),
notes: getSeriesNotes(seriesPage),
words: getSeriesWordCount(seriesPage),
bookmarks: getSeriesBookmarkCount(seriesPage),
complete: getSeriesCompletionStatus(seriesPage),
workCount: getSeriesWorkCount(seriesPage),
works: seriesWorks,
};
};