UNPKG

@accounter/server

Version:

21 lines 706 B
import { GraphQLError } from 'graphql'; import { CountriesProvider } from '../providers/countries.provider.js'; export const countriesResolvers = { Query: { allCountries: async (_, __, { injector }) => { try { return injector.get(CountriesProvider).getAllCountries(); } catch (e) { console.error('Error fetching countries', e); throw new GraphQLError('Error fetching countries'); } }, }, Country: { id: dbCountry => dbCountry.code, name: dbCountry => dbCountry.name, code: dbCountry => dbCountry.code, }, }; //# sourceMappingURL=countries.resolver.js.map