import { IdentityContext } from '@app/server/identity'; import { prisma } from '@app/server/prisma/client'; import { BookChapter, QueryBookChapterOneArgs } from '@generated/types'; import { toBookChapterSchema } from './mappers/bookChapterMapper'; export async function BookChapterOneResolver( _: any, { id }: QueryBookChapterOneArgs, { req, res, identity }: IdentityContext ): Promise { const model = await prisma.bookChapter.findUniqueOrThrow({ where: { id } }); return toBookChapterSchema(model, { req, res, identity }); }