express-toolkit 1.0.7 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/router.js +4 -4
package/package.json
CHANGED
package/src/router.js
CHANGED
|
@@ -90,7 +90,7 @@ function buildRouter (config) {
|
|
|
90
90
|
})
|
|
91
91
|
|
|
92
92
|
const deleteByIdMiddleware = asyncMiddleware(async (req, res, next) => {
|
|
93
|
-
await config.controller.deleteById(req.params[config.id])
|
|
93
|
+
await config.controller.deleteById(req.params[config.id], req.query)
|
|
94
94
|
req.toSend = null
|
|
95
95
|
return next()
|
|
96
96
|
})
|
|
@@ -116,13 +116,13 @@ function buildRouter (config) {
|
|
|
116
116
|
})
|
|
117
117
|
|
|
118
118
|
const patchByIdMiddleware = asyncMiddleware(async (req, res, next) => {
|
|
119
|
-
const resource = await config.controller.patchById(req.params[config.id], req.body)
|
|
119
|
+
const resource = await config.controller.patchById(req.params[config.id], req.body, req.query)
|
|
120
120
|
req.toSend = resource
|
|
121
121
|
return next()
|
|
122
122
|
})
|
|
123
123
|
|
|
124
124
|
const replaceByIdMiddleware = asyncMiddleware(async (req, res, next) => {
|
|
125
|
-
const resource = await config.controller.replaceById(req.params[config.id], req.body)
|
|
125
|
+
const resource = await config.controller.replaceById(req.params[config.id], req.body, req.query)
|
|
126
126
|
req.toSend = resource
|
|
127
127
|
return next()
|
|
128
128
|
})
|
|
@@ -181,7 +181,7 @@ function buildRouter (config) {
|
|
|
181
181
|
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
-
for (
|
|
184
|
+
for (const endpointName in endpoints) {
|
|
185
185
|
/**
|
|
186
186
|
* This is for reto-compatibility reasons, some hooks (due to a bug or a bad design decision)
|
|
187
187
|
* did not match the middleware name, for example the pre:update hook is run before the updateByQuery
|