resolveViaServiceModify<Value, Serialized> function
GraphQLFieldResolver<Value?, Serialized>
resolveViaServiceModify<Value, Serialized>(
- Service<
dynamic, Value?> service, { - String idField = 'id',
A GraphQL resolver that modifies
a single value from an Angel service.
This resolver should be used on a field with at least the following inputs:
id
: agraphQLId
orgraphQLString
data
: aGraphQLObjectType
corresponding to the format ofdata
to be passed tomodify
The arguments passed to the resolver will be forwarded to the service, and the
service will receive Providers.graphql
.
Implementation
GraphQLFieldResolver<Value?, Serialized>
resolveViaServiceModify<Value, Serialized>(Service<dynamic, Value?> service,
{String idField = 'id'}) {
return (_, arguments) async {
var _requestInfo = _fetchRequestInfo(arguments);
var params = {'query': _getQuery(arguments), 'provider': Providers.graphQL}
..addAll(_requestInfo);
var id = arguments.remove(idField);
return await service.modify(id, arguments['data'] as Value?, params);
};
}