From 84134ef7424039431bb2c8b6f58af2c7fb6bf198 Mon Sep 17 00:00:00 2001
From: Hugo SUBTIL <ext.sopra.husubtil@grandlyon.com>
Date: Tue, 3 May 2022 15:14:52 +0200
Subject: [PATCH] fix: konnector def

---
 .editorconfig      |  2 +-
 manifest.konnector | 17 +----------------
 src/index.js       | 11 +++++++++--
 3 files changed, 11 insertions(+), 19 deletions(-)

diff --git a/.editorconfig b/.editorconfig
index cd230f5..150979a 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -5,7 +5,7 @@ root = true
 
 [*]
 charset = utf-8
-end_of_line = crlf
+end_of_line = lf
 trim_trailing_whitespace = true
 insert_final_newline = true
 indent_style = space
diff --git a/manifest.konnector b/manifest.konnector
index 45b0262..e26d1d5 100644
--- a/manifest.konnector
+++ b/manifest.konnector
@@ -11,23 +11,8 @@
   "categories": ["energy"],
   "frequency": "daily",
   "fields": {
-    "wso2BaseUrl": {
-      "type": "hidden"
-    },
-    "loginUtilisateur": {
-      "type": "hidden"
-    },
-    "apiToken": {
-      "type": "hidden"
-    },
-    "pdl": {
+    "pointId": {
       "type": "text"
-    },
-    "nom": {
-      "type": "password"
-    },
-    "prenom": {
-      "type": "password"
     }
   },
   "data_types": [
diff --git a/src/index.js b/src/index.js
index da6036c..43ea082 100644
--- a/src/index.js
+++ b/src/index.js
@@ -291,6 +291,7 @@ function processData(doctype = 'com.grandlyon.enedis.day') {
 
     log('info', 'Agregate enedis daily data for month and year')
     if (doctype === 'com.grandlyon.enedis.day') {
+      log('info', 'Agregating...')
       await agregateMonthAndYearData(processedDailyData)
     }
   }
@@ -306,8 +307,14 @@ function processStartDate() {
       throw err
     }
     // update start Date with contract openning date
-    startDailyDate = moment(parseSgeXmlTechnicalData(result), 'YYYY-MM-DD')
-    startDailyDateString = startDailyDate.format('YYYY-MM-DD')
+    try {
+      startDailyDate = moment(parseSgeXmlTechnicalData(result), 'YYYY-MM-DD')
+      startDailyDateString = startDailyDate.format('YYYY-MM-DD')
+    } catch (err) {
+      log('error', err)
+      //TODO: custom error ?
+      throw err
+    }
   }
 }
 
-- 
GitLab