-
-
Notifications
You must be signed in to change notification settings - Fork 795
Closed
Milestone
Description
Sometimes you want to update multiple resources e.g. via REST sending a PUT /todos or DELETE /todos. Supporting this is fairly easy, the question is what method signatures to use. Currently I see two options.
Option 1: *Many service methods
We could add updateMany, patchMany and removeMany (and possibly createMany although it would just be passing an array to create).
var myService = {
find: function(params, callback) {},
get: function(id, params, callback) {},
create: function(data, params, callback) {},
update: function(id, data, params, callback) {},
updateMany: function(data, params, callback) {},
patch: function(id, data, params, callback) {},
patchMany: function(data, params, callback) {},
remove: function(id, params, callback) {},
removeMany: function(params, callback) {},
setup: function(app) {}
}- + Backwards compatible
- - Cluttered service interface
Option 2: null values for id
The other option is to pass a null value as an id when operating on multiple resources.
app.use('/todos', {
remove: function(id, params, callback) {
if(id === null) {
}
}
}- + Keeps service interface the same
- - Could break backwards compatibility in some cases (although you would most likely just return a
notFounderror)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels