@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cuboapp/api-backend",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "Backend Api for CuboApp",
5
5
  "main": "src/index.ts",
6
6
  "repository": "git@github.com:cuboapp/api-backend.git",
@@ -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)) {