implemented identity, updated session, added 'workings' list
added paginated querying, added 'common'
This commit is contained in:
parent
027deba422
commit
6ada519e06
36 changed files with 1422 additions and 279 deletions
14
app/server/graphql/resolvers/identityResolver.ts
Normal file
14
app/server/graphql/resolvers/identityResolver.ts
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import { IdentityContext } from '@app/server/identity';
|
||||
import { prisma } from '@app/server/prisma/client';
|
||||
import { Identity } from '@generated/types';
|
||||
import { toIdentitySchema } from './mappers/identityMapper';
|
||||
|
||||
export async function IdentityResolver(
|
||||
_: any,
|
||||
__: any,
|
||||
{ identity }: IdentityContext
|
||||
): Promise<Identity> {
|
||||
if (identity == null) throw new Error('Unauthorized.');
|
||||
const model = await prisma.user.findUniqueOrThrow({ where: { id: identity.id } });
|
||||
return toIdentitySchema(model);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue