Skip to content

Commit

Permalink
Merge pull request #1580 from KeshavSoni2511/Fix_For_1515
Browse files Browse the repository at this point in the history
typeInformation contain global config values
  • Loading branch information
fgalan committed Feb 22, 2024
2 parents bc529ca + c8433b5 commit 18524dc
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGES_NEXT_RELEASE
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
- 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 @@ -301,11 +300,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 18524dc

Please sign in to comment.