db-crud-api 0.1.5 → 0.1.6

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
@@ -16,4 +16,9 @@
16
16
 
17
17
  Bug fix:
18
18
  - deleteById function crash
19
- - new function return undefined
19
+ - new function return undefined
20
+ ## v0.1.5 (2024-03-03)
21
+ ## v0.1.6 (2024-03-03)
22
+
23
+ Bug fix:
24
+ - update function crash with date value
package/lib/mssql.js CHANGED
@@ -6,11 +6,11 @@ const pools = {};
6
6
 
7
7
  // Common
8
8
  function stringifyValue(fieldName, value, tSchema) {
9
- if (!value) { return 'null' }
10
- if (value.trimStart().charAt(0) !== '[') {
9
+ if (value == undefined) { return 'null' }
10
+ if (typeof value !== 'string' || value.trimStart().charAt(0) !== '[') {
11
11
  if (tSchema.table.fields && tSchema.table.fields[fieldName] && tSchema.table.fields[fieldName].type) {
12
12
  if (tSchema.table.fields[fieldName].type == 'datetime') {
13
- if (typeof value == 'datetime') return `\'${value.toISOString()}\'`;
13
+ if (typeof value == 'datetime' || typeof value == 'object') return `\'${value.toISOString()}\'`;
14
14
  if (typeof value == 'string' && value.trimStart().charAt(0) !== '\'' && value.trimStart().charAt(0) !== '\"') return `\'${value}\'`;
15
15
  return value;
16
16
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "db-crud-api",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "type": "module",
5
5
  "description": "CRUD api for database tables",
6
6
  "main": "index.js",