ln/app/server/graphql/resolvers/booksManyResolver.ts
2025-04-06 19:57:14 +03:00

24 lines
456 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,
{ identity }: IdentityContext
): Promise<Book[]> {
if (identity == null) throw new Error('Unauthorized');
return books;
}