@cuboapp/api-backend 1.0.4 → 1.0.5
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/package.json +1 -1
- package/src/helpers/index.ts +3 -1
- package/src/index.ts +3 -0
package/package.json
CHANGED
package/src/helpers/index.ts
CHANGED
|
@@ -99,6 +99,8 @@ export class ApiHelpers<T extends CuboApiEntitiesMap<T>> {
|
|
|
99
99
|
case 'string':
|
|
100
100
|
if (value === 'null') {
|
|
101
101
|
value = null
|
|
102
|
+
} else if ([CUBO_CRUD_QUERY_CONDITION.IN, CUBO_CRUD_QUERY_CONDITION.NIN].includes(condition)) {
|
|
103
|
+
value = value.split(',')
|
|
102
104
|
}
|
|
103
105
|
break
|
|
104
106
|
case 'number':
|
|
@@ -132,7 +134,7 @@ export class ApiHelpers<T extends CuboApiEntitiesMap<T>> {
|
|
|
132
134
|
value = null
|
|
133
135
|
} else {
|
|
134
136
|
if ([CUBO_CRUD_QUERY_CONDITION.IN, CUBO_CRUD_QUERY_CONDITION.NIN].includes(condition)) {
|
|
135
|
-
value = value.split(',')
|
|
137
|
+
value = value.split(',').map(Number)
|
|
136
138
|
} else {
|
|
137
139
|
const potentialValue = precision === 0 ? parseInt(value) : parseFloat(value)
|
|
138
140
|
|
package/src/index.ts
CHANGED
|
@@ -333,6 +333,9 @@ export class CuboBackendApi<T extends CuboApiEntitiesMap<T>> {
|
|
|
333
333
|
}
|
|
334
334
|
|
|
335
335
|
const item: any = await this.getOne(entityAlias, req, opts)
|
|
336
|
+
if (!item) {
|
|
337
|
+
throw { status: 404, text: 'Entity not found' }
|
|
338
|
+
}
|
|
336
339
|
|
|
337
340
|
const dto = await this.helpers.data.prepare('delete', entity!.fields, req.body || {}, opts?.performer_id)
|
|
338
341
|
if (!Object.keys(dto)) {
|