Future<Response>
updateObject(String id)
Source
@httpPut
Future<Response> updateObject(@HTTPPath("id") String id) async {
var primaryKey = _query.entity.primaryKey;
_query.where[primaryKey] = whereEqualTo(
_parseValueForProperty(id, _query.entity.properties[primaryKey]));
InstanceType instance = _query.entity.instanceType
.newInstance(new Symbol(""), []).reflectee as InstanceType;
instance.readFromMap(request.body.asMap());
_query.values = instance;
_query = await willUpdateObjectWithQuery(_query);
var results = await _query?.updateOne();
if (results == null) {
return didNotFindObjectToUpdateWithID(id);
} else {
return didUpdateObject(results);
}
}