From d8036ac7eaddba931166633acd0c79ee4f648400 Mon Sep 17 00:00:00 2001 From: Yoan VALLET <ext.sopra.yvallet@grandlyon.com> Date: Wed, 10 Jun 2020 13:34:10 +0200 Subject: [PATCH] publish: clean code generated from commit 433c2f5529a432d72f0be8e37f046625060bcbff --- index.js | 28 ++++++++++++---------------- manifest.konnector | 1 - 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/index.js b/index.js index 3636b56..e443c6a 100644 --- a/index.js +++ b/index.js @@ -145,15 +145,15 @@ const endDate = moment().format('MM/DD/YYYY') const timeRange = ['day', 'month', 'year'] const rangeDate = { day: { - doctype: 'io.egl.day', + doctype: 'com.grandlyon.egl.day', keys: ['year', 'month', 'day'] }, month: { - doctype: 'io.egl.month', + doctype: 'com.grandlyon.egl.month', keys: ['year', 'month'] }, year: { - doctype: 'io.egl.year', + doctype: 'com.grandlyon.egl.year', keys: ['year'] } } @@ -228,15 +228,11 @@ async function authenticate(login, password, baseUrl, apiAuthKey) { }, json: true } - try { - const response = await rp(authRequest) - if (response.codeRetour === 100) { - return response - } else { - throw new Error(errors.LOGIN_FAILED) - } - } catch (error) { - throw error + const response = await rp(authRequest) + if (response.codeRetour === 100) { + return response + } else { + throw new Error(errors.LOGIN_FAILED) } } @@ -259,10 +255,10 @@ async function getData(response, baseUrl, apiAuthKey) { json: true } try { - const response = await rp(dataRequest) - switch (response.codeRetour) { + const responseEgl = await rp(dataRequest) + switch (responseEgl.codeRetour) { case 100: - return format(response) + return format(responseEgl) case -2: throw new Error(errors.LOGIN_FAILED) case -1: @@ -355,7 +351,7 @@ async function storeData(data, doctype, keys) { /** * Function handling special case. * The temporary aggregated data need to be remove in order for the most recent one te be saved. - * ex for io.egl.month : + * ex for com.grandlyon.egl.month : * { load: 76.712, month: 2020, ... } need to be replace by * { load: 82.212, month: 2020, ... } after grdf data reprocess */ diff --git a/manifest.konnector b/manifest.konnector index ec075f4..2d0e30a 100644 --- a/manifest.konnector +++ b/manifest.konnector @@ -56,4 +56,3 @@ }, "manifest_version": "2" } - -- GitLab