import { objectType } from '@nexus/schema'; import { NodeType } from '../../../schema/node'; import { RecipeType } from '../../recipe'; import { authenticateQuery } from '../../../schema/authenticate-query'; import { ForbiddenError } from 'apollo-server-micro'; // The Recipe Definition export const UserType = objectType({ name: 'User', definition(t) { t.implements('Node'); t.model.firstName(); t.model.lastName(); t.model.email(); // t.list.field('recipes', { // type: 'Recipe', // description: 'A list of recipes owned by this user', // resolve: async (root, args, ctx, info) => { // // Authenticate // const { user, abilities } = authenticateQuery(ctx); // // Resolve // // fetch all recipes for the current user // const recipes = root // .getRecipes() // .accessibleBy(abilities) // .catch(() => { // throw new ForbiddenError('Error Retrieving Recipes'); // }); // return recipes; // }, // }); }, }); export { userQF } from './fetch-user'; export { registerUserMF, RegisterUserInputType } from './register-user'; // export { updateUserMF, UpdateUserInputType } from './update-user'; // export { deleteUserMF } from './delete-user'; // export { loginUserMF, LoginUserIputType, SessionType } from './login-user';