From 0e5f40d9b83d4388c3973a40c71dc5b658cddfa0 Mon Sep 17 00:00:00 2001 From: burgerni10 Date: Fri, 8 Sep 2023 13:05:35 +0200 Subject: [PATCH] fix(connectors): filter up-to-date connectors only --- .../north-connector.repository.spec.ts | 8 ++++---- .../repository/north-connector.repository.ts | 3 ++- .../south-connector.repository.spec.ts | 12 ++++++------ .../repository/south-connector.repository.ts | 19 ++++++++++++++++++- 4 files changed, 30 insertions(+), 12 deletions(-) diff --git a/backend/src/repository/north-connector.repository.spec.ts b/backend/src/repository/north-connector.repository.spec.ts index bb3a172284..db2cf5ec8a 100644 --- a/backend/src/repository/north-connector.repository.spec.ts +++ b/backend/src/repository/north-connector.repository.spec.ts @@ -28,7 +28,7 @@ describe('North connector repository', () => { { id: 'id1', name: 'north1', - type: 'NorthConnector', + type: 'oianalytics', description: 'My north connector', enabled: true, settings: {}, @@ -49,7 +49,7 @@ describe('North connector repository', () => { { id: 'id2', name: 'north2', - type: 'NorthConnector', + type: 'oianalytics', description: 'My second north connector', enabled: true, settings: {}, @@ -72,7 +72,7 @@ describe('North connector repository', () => { { id: 'id1', name: 'north1', - type: 'NorthConnector', + type: 'oianalytics', description: 'My north connector', enabled: true, settings: JSON.stringify({}), @@ -89,7 +89,7 @@ describe('North connector repository', () => { { id: 'id2', name: 'north2', - type: 'NorthConnector', + type: 'oianalytics', description: 'My second north connector', enabled: true, settings: JSON.stringify({}), diff --git a/backend/src/repository/north-connector.repository.ts b/backend/src/repository/north-connector.repository.ts index fa848658d7..e94dc6628e 100644 --- a/backend/src/repository/north-connector.repository.ts +++ b/backend/src/repository/north-connector.repository.ts @@ -43,7 +43,8 @@ export default class NorthConnectorRepository { enabled: result.archiveEnabled, retentionDuration: result.archiveRetentionDuration } - })); + })) + .filter(result => ['aws-s3', 'azure-blob', 'console', 'file-writer', 'oianalytics', 'oibus', 'rest-api'].includes(result.type)); } /** diff --git a/backend/src/repository/south-connector.repository.spec.ts b/backend/src/repository/south-connector.repository.spec.ts index b1975b4343..787b2a05b4 100644 --- a/backend/src/repository/south-connector.repository.spec.ts +++ b/backend/src/repository/south-connector.repository.spec.ts @@ -28,7 +28,7 @@ describe('South connector repository', () => { { id: 'id1', name: 'south1', - type: 'SouthConnector', + type: 'oianalytics', description: 'My south connector', enabled: true, history: { @@ -41,7 +41,7 @@ describe('South connector repository', () => { { id: 'id2', name: 'south2', - type: 'SouthConnector', + type: 'oianalytics', description: 'My second south connector', enabled: true, history: { @@ -56,7 +56,7 @@ describe('South connector repository', () => { { id: 'id1', name: 'south1', - type: 'SouthConnector', + type: 'oianalytics', description: 'My south connector', enabled: true, maxInstantPerItem: true, @@ -67,7 +67,7 @@ describe('South connector repository', () => { { id: 'id2', name: 'south2', - type: 'SouthConnector', + type: 'oianalytics', description: 'My second south connector', enabled: true, maxInstantPerItem: false, @@ -88,7 +88,7 @@ describe('South connector repository', () => { const expectedValue: SouthConnectorDTO = { id: 'id1', name: 'south1', - type: 'SouthConnector', + type: 'oianalytics', description: 'My south connector', enabled: true, history: { @@ -101,7 +101,7 @@ describe('South connector repository', () => { get.mockReturnValueOnce({ id: 'id1', name: 'south1', - type: 'SouthConnector', + type: 'oianalytics', description: 'My south connector', enabled: true, maxInstantPerItem: false, diff --git a/backend/src/repository/south-connector.repository.ts b/backend/src/repository/south-connector.repository.ts index 6b52e1e33a..885b02487f 100644 --- a/backend/src/repository/south-connector.repository.ts +++ b/backend/src/repository/south-connector.repository.ts @@ -32,7 +32,24 @@ export default class SouthConnectorRepository { readDelay: result.readDelay }, settings: JSON.parse(result.settings) - })); + })) + .filter(result => + [ + 'ads', + 'folder-scanner', + 'modbus', + 'mqtt', + 'mssql', + 'mysql', + 'odbc', + 'oianalytics', + 'opcua', + 'oracle', + 'postgresql', + 'slims', + 'sqlite' + ].includes(result.type) + ); } /**