From e487d1746734d24c52bf3d28cbdda365a5d6e7e3 Mon Sep 17 00:00:00 2001 From: Jason Fox Date: Mon, 7 Sep 2020 18:26:55 +0200 Subject: [PATCH 1/2] Add common NGSI-LD constants Add GeoProperty, Point , Date and Time types since GeoJSON is native in NGSI-LD --- lib/constants.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/constants.js b/lib/constants.js index 14aa7861b..de8ac23e2 100644 --- a/lib/constants.js +++ b/lib/constants.js @@ -36,10 +36,18 @@ const ATTRIBUTE_DEFAULT = ' '; * @return {String} A default value to use in the entity */ function getInitialValueForType(type) { - switch (type) { - case LOCATION_TYPE: + switch (type.toLowerCase()) { + case 'geoproperty': return LOCATION_DEFAULT; - case DATETIME_TYPE: + case 'point': + return LOCATION_DEFAULT; + case 'geo:point': + return LOCATION_DEFAULT; + case 'datetime': + return DATETIME_DEFAULT; + case 'date': + return DATETIME_DEFAULT; + case 'time': return DATETIME_DEFAULT; default: return ATTRIBUTE_DEFAULT; From 9d65c098f688046919115f878abdb2eb135a2c5c Mon Sep 17 00:00:00 2001 From: Jason Fox Date: Tue, 8 Sep 2020 11:41:46 +0200 Subject: [PATCH 2/2] Remove unused constants --- lib/constants.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/constants.js b/lib/constants.js index de8ac23e2..b061b57c3 100644 --- a/lib/constants.js +++ b/lib/constants.js @@ -23,9 +23,7 @@ * Modified by: Daniel Calvo - ATOS Research & Innovation */ -const LOCATION_TYPE = 'geo:point'; const LOCATION_DEFAULT = '0, 0'; -const DATETIME_TYPE = 'DateTime'; const DATETIME_DEFAULT = '1970-01-01T00:00:00.000Z'; const ATTRIBUTE_DEFAULT = ' ';