@opengis/fastify-table 1.0.50 → 1.0.51

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/Changelog.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # fastify-table
2
2
 
3
+ ## 1.0.51 - 27.06.2024
4
+
5
+ - add next-id api
6
+
3
7
  ## 1.0.50 - 27.06.2024
4
8
 
5
9
  - refactor search api
@@ -0,0 +1,4 @@
1
+ export default async function nextId({ pg }) {
2
+ const { id } = await pg.one('select next_id() as id');
3
+ return { id: id.toString() };
4
+ };
package/crud/index.js CHANGED
@@ -4,6 +4,7 @@ import isFileExists from './funcs/isFileExists.js';
4
4
  import dataUpdate from './funcs/dataUpdate.js';
5
5
  import dataInsert from './funcs/dataInsert.js';
6
6
 
7
+ import nextId from './controllers/next.id.js';
7
8
  import update from './controllers/update.js';
8
9
  import insert from './controllers/insert.js';
9
10
  import deleteCrud from './controllers/deleteCrud.js';
@@ -24,6 +25,7 @@ async function plugin(fastify, config = {}) {
24
25
  fastify.decorate('isFileExists', isFileExists);
25
26
 
26
27
  // api
28
+ fastify.get(`${prefix}/next-id`, {}, nextId);
27
29
  fastify.put(`${prefix}/table/:table/:id`, {}, update);
28
30
  fastify.delete(`${prefix}/table/:table/:id`, {}, deleteCrud);
29
31
  fastify.post(`${prefix}/table/:table`, {}, insert);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengis/fastify-table",
3
- "version": "1.0.50",
3
+ "version": "1.0.51",
4
4
  "type": "module",
5
5
  "description": "core-plugins",
6
6
  "main": "index.js",