angular2-jsonapi icon indicating copy to clipboard operation
angular2-jsonapi copied to clipboard

Omit relationships when saving record

Open hpawe01 opened this issue 5 years ago • 1 comments

At the moment, when I save a model, for that already some relationships are loaded, the resulting PATCH request contains all the relationships, which can bloat up the request: https://github.com/ghidoz/angular2-jsonapi/blob/master/projects/angular2-jsonapi/src/services/json-api-datastore.service.ts#L148

Is there a way to send the PATCH request without the relationships, that I do not think of?

Because following the specification, there should be both ways possible: https://jsonapi.org/format/#crud-updating-resource-relationships

If there is no possibility at the moment: any suggestions on how to implement it? Than I could create a pull request.

hpawe01 avatar Nov 22 '19 21:11 hpawe01

It's a big problem. if a same object has been modified by another user the patch operation can result in an error at backend side. Dbconcurrency exception per example. Because one of the relationships has been modified between the last refresh and the update operation . If you want to update a single value , have this kind of error is ridiculous...

Need a fix for this...

bosk59 avatar May 13 '20 08:05 bosk59