added chapter view, fixes, added ratings, added chapter updates/deletions
This commit is contained in:
parent
029b7e9353
commit
4801cf3a13
34 changed files with 1345 additions and 191 deletions
|
|
@ -7,7 +7,7 @@ import { toBookChapterSchema } from './mappers/bookChapterMapper';
|
|||
export async function BookChapterManyResolver(
|
||||
_: any,
|
||||
{ input }: QueryBookChapterManyArgs,
|
||||
{ identity }: IdentityContext
|
||||
{ req, res, identity }: IdentityContext
|
||||
): Promise<BookChapterManyOutput> {
|
||||
const { bookId, filter } = input;
|
||||
const terms = filter.terms?.toLowerCase();
|
||||
|
|
@ -19,11 +19,14 @@ export async function BookChapterManyResolver(
|
|||
const items = await prisma.bookChapter.findMany({
|
||||
where: bookChapterWhere,
|
||||
skip: filter.offset ?? 0,
|
||||
take: filter.size ?? 10
|
||||
take: filter.size ?? 10,
|
||||
orderBy: { sequenceNumber: 'asc' }
|
||||
});
|
||||
|
||||
return {
|
||||
items: await Promise.all(items.map(value => toBookChapterSchema(value))),
|
||||
items: await Promise.all(
|
||||
items.map(value => toBookChapterSchema(value, { req, res, identity }))
|
||||
),
|
||||
total: items.length
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue