import { IdentityContext } from '@app/server/identity'; import { prisma } from '@app/server/prisma/client'; import { Book, QueryBookOneArgs } from '@generated/types'; import { toBookSchema } from './mappers/bookMapper'; export async function BookOneResolver( _: any, { id }: QueryBookOneArgs, { identity }: IdentityContext ): Promise { const model = await prisma.book.findUniqueOrThrow({ where: { id } }); return toBookSchema(model); }