nodester 0.7.1 → 0.7.11
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/lib/body/extract.js
CHANGED
|
@@ -60,7 +60,7 @@ function extract(body, filter=null, model) {
|
|
|
60
60
|
const typeName = column.type.constructor.name;
|
|
61
61
|
// Optional validation.
|
|
62
62
|
const { validation } = column;
|
|
63
|
-
|
|
63
|
+
|
|
64
64
|
const sanitizationOptions = {
|
|
65
65
|
fallback: column.defaultValue ?? undefined,
|
|
66
66
|
min: validation?.min ?? undefined,
|
|
@@ -85,7 +85,7 @@ function extract(body, filter=null, model) {
|
|
|
85
85
|
const thisIncludeFilter = filter.includes[key];
|
|
86
86
|
|
|
87
87
|
const association = model.associations[key];
|
|
88
|
-
|
|
88
|
+
|
|
89
89
|
// Mutliple includes:
|
|
90
90
|
if (Array.isArray(value)) {
|
|
91
91
|
filteredBody[key] = [];
|
|
@@ -114,6 +114,6 @@ function extract(body, filter=null, model) {
|
|
|
114
114
|
for (const [ key, value ] of staticAttributeEntries) {
|
|
115
115
|
filteredBody[key] = staticAttributes[key];
|
|
116
116
|
}
|
|
117
|
-
|
|
117
|
+
|
|
118
118
|
return filteredBody;
|
|
119
119
|
}
|
|
@@ -17,12 +17,12 @@ module.exports = {
|
|
|
17
17
|
ENUM: _ENUM,
|
|
18
18
|
|
|
19
19
|
NUMBER: _NUMBER,
|
|
20
|
-
|
|
20
|
+
|
|
21
21
|
INT: _INTEGER,
|
|
22
22
|
INTEGER: _INTEGER,
|
|
23
|
+
BIGINT: _INTEGER,
|
|
23
24
|
|
|
24
25
|
BOOLEAN: _BOOLEAN,
|
|
25
|
-
|
|
26
26
|
|
|
27
27
|
DATE: _DATE,
|
|
28
28
|
DATETIME: _DATE,
|
|
@@ -35,7 +35,7 @@ function _UUID(value=undefined, options={ fallback:undefined }) {
|
|
|
35
35
|
try {
|
|
36
36
|
if (typeof value !== 'string')
|
|
37
37
|
throw new Error(`Not a valid UUID`);
|
|
38
|
-
|
|
38
|
+
|
|
39
39
|
return value;
|
|
40
40
|
}
|
|
41
41
|
catch(ex) {
|
|
@@ -48,7 +48,7 @@ function _STRING(value=undefined, options={ fallback:undefined }) {
|
|
|
48
48
|
try {
|
|
49
49
|
if (typeof value !== 'string')
|
|
50
50
|
throw new Error(`Not a String`);
|
|
51
|
-
|
|
51
|
+
|
|
52
52
|
return value;
|
|
53
53
|
}
|
|
54
54
|
catch(ex) {
|
|
@@ -60,7 +60,7 @@ function _TEXT(value=undefined, options={ fallback:undefined }) {
|
|
|
60
60
|
try {
|
|
61
61
|
if (typeof value !== 'string')
|
|
62
62
|
throw new Error(`Not a String`);
|
|
63
|
-
|
|
63
|
+
|
|
64
64
|
return value;
|
|
65
65
|
}
|
|
66
66
|
catch(ex) {
|
|
@@ -129,7 +129,7 @@ function _DATE(value=undefined, options={ fallback:undefined }) {
|
|
|
129
129
|
switch(type) {
|
|
130
130
|
case('[object Date]'): {
|
|
131
131
|
if (isNaN(value.valueOf())){
|
|
132
|
-
throw new Error('Not a date');
|
|
132
|
+
throw new Error('Not a date');
|
|
133
133
|
}
|
|
134
134
|
return value;
|
|
135
135
|
}
|