refactor, added slate, added editor, added book
This commit is contained in:
parent
bc250e73bb
commit
029b7e9353
33 changed files with 714 additions and 496 deletions
|
|
@ -1,25 +0,0 @@
|
|||
import { IdentityContext } from '@app/server/identity';
|
||||
import { prisma } from '@app/server/prisma/client';
|
||||
import { BookChapterManyOutput, QueryBookChapterManyArgs } from '@generated/types';
|
||||
import { toBookChapterSchema } from './mappers/bookChapterMapper';
|
||||
|
||||
export async function BookChapterManyResolver(
|
||||
_: any,
|
||||
{ input }: QueryBookChapterManyArgs,
|
||||
{ identity }: IdentityContext
|
||||
): Promise<BookChapterManyOutput> {
|
||||
const { bookId, filter } = input;
|
||||
|
||||
const items = await prisma.bookChapter.findMany({
|
||||
where: {
|
||||
bookId
|
||||
},
|
||||
skip: filter.offset ?? 0,
|
||||
take: filter.size ?? 10
|
||||
});
|
||||
|
||||
return {
|
||||
items: await Promise.all(items.map(value => toBookChapterSchema(value))),
|
||||
total: items.length
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue