a
const AuthorType = new GraphQLObjectType({
name: 'Author',
description: 'Author data with related data',
fields: () => ({
id: { type: GraphQLInt },
name: {
type: GraphQLString,
resolve: (source, args, context, info) => {
if (info.fieldNodes?.[0].directives?.[0]?.name?.value === 'uppercase') {
return source.name.toUpperCase();
}
return source.name;
},
},
}),
});