ln/app/server/graphql/resolvers/booksManyResolver.ts
2025-04-18 14:47:42 +03:00

25 lines
467 B
TypeScript

import { IdentityContext } from '@app/server/identity';
import { Book } from '@generated/types';
export const books = [
{
id: '1',
title: 'some-title-1',
author: 'someone'
},
{
id: '2',
title: 'some-title-1',
author: 'someone'
}
];
export async function BooksManyResolver(
_: any,
__: any,
{ req, res, identity }: IdentityContext
): Promise<Book[]> {
if (identity == null) throw new Error('Unauthorized');
return books;
}