Skip to content

Commit

Permalink
Merge branch 'master' into task/add_typeInformation_in_errors
Browse files Browse the repository at this point in the history
  • Loading branch information
fgalan committed Feb 22, 2024
2 parents ae0c71e + 18524dc commit c7efc8f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
3 changes: 2 additions & 1 deletion CHANGES_NEXT_RELEASE
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
- ADD: Log and return device/group information when EntityGenericError TypeNotFound DeviceNotFound BadTimestamp BadGeocoordinates CommandNotFound GroupNotFound MissingAttributes DuplicateDeviceId and DuplicateGroup errors
- Add: log and return device/group information when EntityGenericError, TypeNotFound, DeviceNotFound, BadTimestamp, BadGeocoordinates, CommandNotFound, GroupNotFound, MissingAttributes, DuplicateDeviceId and DuplicateGroup errors
- Hardening: simplify implementation so typeInformation contains global config values (#1515)
- Add: `POST /iot/op/delete` operation to delete multiple devices at once (#1578)
- Fix: store device subscriptions updates (#1086)
3 changes: 2 additions & 1 deletion doc/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1765,7 +1765,8 @@ Example:
_**Response code**_

- `204` `OK` if successful.
- `404` `NOT FOUND` if one or several devices were not found in the database. Note that although a 404 error is returned the existing devices are deleted.
- `404` `NOT FOUND` if one or several devices were not found in the database. Note that although a 404 error is
returned the existing devices are deleted.
- `500` `SERVER ERROR` if there was any error not considered above.

## Miscellaneous API
Expand Down
9 changes: 3 additions & 6 deletions lib/services/ngsi/entities-NGSI-v2.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ const request = require('../../request-shim');
const alarms = require('../common/alarmManagement');
const errors = require('../../errors');
const pluginUtils = require('../../plugins/pluginUtils');
const config = require('../../commonConfig');
const constants = require('../../constants');
const jexlParser = require('../../plugins/jexlParser');
const expressionPlugin = require('../../plugins/expressionPlugin');
Expand Down Expand Up @@ -309,11 +308,9 @@ function sendUpdateValueNgsi2(entityName, measures, typeInformation, token, call
jexlctxt = reduceAttrToPlainObject(idTypeSSSList, jexlctxt);

//Managing timestamp (mustInsertTimeInstant flag to decide if we should insert Timestamp later on)
const mustInsertTimeInstant =
typeInformation.timestamp !== undefined
? typeInformation.timestamp
: config.getConfig().timestamp !== undefined
? config.getConfig().timestamp
const mustInsertTimeInstant =
typeInformation.timestamp !== undefined
? typeInformation.timestamp
: false;

if (mustInsertTimeInstant) {
Expand Down
4 changes: 2 additions & 2 deletions lib/services/ngsi/ngsiService.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ function executeWithDeviceInformation(operationFunction) {
// For preregistered devices, augment the existing deviceInformation with selected attributes.
if (!callback) {
callback = deviceInformation;
typeInformation = deviceGroup || configDeviceInfo;
typeInformation = deviceGroup || { ...config.getConfig(), ...configDeviceInfo };
} else {
typeInformation = deviceInformation;
typeInformation = { ...config.getConfig(), ...deviceInformation };
attributeList.forEach((key) => {
typeInformation[key] =
typeInformation[key] || (deviceGroup || {})[key] || (configDeviceInfo || {})[key];
Expand Down

0 comments on commit c7efc8f

Please sign in to comment.