UNPKG

@accounter/server

Version:
37 lines 1.44 kB
import { GraphQLError } from 'graphql'; import { BusinessUsersProvider } from '../providers/business-users.provider.js'; export const businessUsersResolvers = { Query: { listBusinessUsers: async (_, __, { injector }) => { try { return await injector.get(BusinessUsersProvider).listBusinessUsers(); } catch (error) { if (error instanceof GraphQLError) { throw error; } throw new GraphQLError('Failed to list business users', { originalError: error instanceof Error ? error : undefined, extensions: { code: 'BUSINESS_USER_LIST_FAILED' }, }); } }, }, Mutation: { removeBusinessUser: async (_, { userId }, { injector }) => { try { return await injector.get(BusinessUsersProvider).removeBusinessUser(userId); } catch (error) { if (error instanceof GraphQLError) { throw error; } throw new GraphQLError('Failed to remove business user', { originalError: error instanceof Error ? error : undefined, extensions: { code: 'BUSINESS_USER_REMOVAL_FAILED' }, }); } }, }, }; //# sourceMappingURL=business-users.resolver.js.map