@opengis/fastify-table 2.5.68 → 2.5.69
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/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -6
- package/package.json +1 -1
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAgGA,iBAAe,MAAM,CAAC,OAAO,EAAE,GAAG,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAgGA,iBAAe,MAAM,CAAC,OAAO,EAAE,GAAG,iBAiQjC;;AACD,wBAEG"}
|
package/dist/index.js
CHANGED
|
@@ -175,12 +175,24 @@ async function plugin(fastify) {
|
|
|
175
175
|
fastify.register(dblistRoutes, opt);
|
|
176
176
|
}
|
|
177
177
|
fastify.addHook("preValidation", async (request) => {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
.
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
.
|
|
178
|
+
if (request.method === "PUT") {
|
|
179
|
+
// if put request => "" => null === update x=null
|
|
180
|
+
Object.keys(request.query || {})
|
|
181
|
+
.filter((key) => request.query[key] === "")
|
|
182
|
+
.forEach((key) => Object.assign(request.query, { [key]: null }));
|
|
183
|
+
Object.keys(request.body || {})
|
|
184
|
+
.filter((key) => request.body[key] === "")
|
|
185
|
+
.forEach((key) => Object.assign(request.body, { [key]: null }));
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
// if post request => "" => delete
|
|
189
|
+
Object.keys(request.query || {})
|
|
190
|
+
.filter((key) => request.query[key] === "")
|
|
191
|
+
.forEach((key) => delete request.query[key]);
|
|
192
|
+
Object.keys(request.body || {})
|
|
193
|
+
.filter((key) => request.body[key] === "")
|
|
194
|
+
.forEach((key) => delete request.body[key]);
|
|
195
|
+
}
|
|
184
196
|
});
|
|
185
197
|
fastify.addHook("preHandler", async (request, reply) => {
|
|
186
198
|
const q = request.query;
|