@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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAgGA,iBAAe,MAAM,CAAC,OAAO,EAAE,GAAG,iBAsPjC;;AACD,wBAEG"}
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
- Object.keys(request.query || {})
179
- .filter((key) => request.query[key] === "")
180
- .forEach((key) => delete request.query[key]);
181
- Object.keys(request.body || {})
182
- .filter((key) => request.body[key] === "")
183
- .forEach((key) => delete request.body[key]);
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengis/fastify-table",
3
- "version": "2.5.68",
3
+ "version": "2.5.69",
4
4
  "type": "module",
5
5
  "description": "core-plugins",
6
6
  "keywords": [