db-crud-api 0.3.0 → 0.3.1

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
@@ -40,4 +40,8 @@
40
40
  Changes:
41
41
  - execute api definition
42
42
  Added:
43
- - support for mySQL
43
+ - support for mySQL
44
+ ## v0.3.1 (2025-01-01)
45
+
46
+ Bug fix:
47
+ - autoId flag not onored
package/lib/api-full.js CHANGED
@@ -46,7 +46,7 @@ export default class apiFull {
46
46
  async put(reqOpe) {
47
47
  const _dbOpe = dbOpe.preparePut(this.#schema, this.#connection, reqOpe);
48
48
  if (_dbOpe.put.sets) {
49
- if (this.#schema.autoId === true) // automatic Id
49
+ if (dbOpe.autoId(this.#schema)) // automatic Id
50
50
  if (!Object.keys(_dbOpe.put.sets).find(key => key.toUpperCase() === (dbOpe.idField(this.#schema)).toUpperCase())) {
51
51
  _dbOpe.put.sets[dbOpe.idField(this.#schema)] = uuidv4(); // automatic Id via uuidv4
52
52
  }
@@ -15,6 +15,10 @@ export function idField(tSchema) {
15
15
  return tSchema.table?.idField ?? 'id';
16
16
  }
17
17
 
18
+ export function autoId(tSchema) {
19
+ return tSchema.table?.autoId;
20
+ }
21
+
18
22
  export async function runQuery(dbOpes) {
19
23
 
20
24
  // all connections must have same id
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "db-crud-api",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "type": "module",
5
5
  "description": "CRUD api for database tables",
6
6
  "main": "index.js",