retrieveConsumption method in plural
MODIFY
src/integration/asset/AssetIntegration.ts
src/integration/asset/AssetIntegration.ts
import { AssetConnectionSetting, AssetSetting } from '../../types/Setting';
-import Consumption, { AbstractCurrentConsumption } from '../../types/Consumption';
+import { AbstractCurrentConsumption } from '../../types/Consumption';
import Asset from '../../types/Asset';
export default abstract class AssetIntegration<T extends AssetSetting> {
@@ -16,6 +16,5 @@ export default abstract class AssetIntegration<T extends AssetSetting> {
abstract checkConnection(): Promise<void>;
- abstract retrieveConsumption(asset: Asset, manualCall?: boolean): Promise<AbstractCurrentConsumption[]>;
-
+ abstract retrieveConsumptions(asset: Asset, manualCall?: boolean): Promise<AbstractCurrentConsumption[]>;
}

MODIFY
src/integration/asset/greencom/GreencomAssetIntegration.ts
src/integration/asset/greencom/GreencomAssetIntegration.ts
@@ -27,7 +27,7 @@ export default class GreencomAssetIntegration extends AssetIntegration<AssetSett
await this.connect();
}
- public async retrieveConsumption(asset: Asset, manualCall?: boolean): Promise<AbstractCurrentConsumption[]> {
+ public async retrieveConsumptions(asset: Asset, manualCall?: boolean): Promise<AbstractCurrentConsumption[]> {
// Set new Token
const token = await this.connect();
const request = manualCall ?

MODIFY
src/integration/asset/schneider/SchneiderAssetIntegration.ts
src/integration/asset/schneider/SchneiderAssetIntegration.ts
import Asset, { AssetType, SchneiderProperty } from '../../../types/Asset';
import { AssetConnectionSetting, AssetSetting } from '../../../types/Setting';
-import Consumption, { AbstractCurrentConsumption } from '../../../types/Consumption';
+import { AbstractCurrentConsumption } from '../../../types/Consumption';
import AssetIntegration from '../AssetIntegration';
import AxiosFactory from '../../../utils/AxiosFactory';
import { AxiosInstance } from 'axios';
@@ -26,7 +26,7 @@ export default class SchneiderAssetIntegration extends AssetIntegration<AssetSet
await this.connect();
}
- public async retrieveConsumption(asset: Asset): Promise<AbstractCurrentConsumption[]> {
+ public async retrieveConsumptions(asset: Asset): Promise<AbstractCurrentConsumption[]> {
// Set new Token
const token = await this.connect();
const request = `${this.connection.url}/${asset.meterID}`;

MODIFY
src/scheduler/tasks/AssetGetConsumptionTask.ts
src/scheduler/tasks/AssetGetConsumptionTask.ts
@@ -40,7 +40,7 @@ export default class AssetGetConsumptionTask extends SchedulerTask {
const assetImpl = await AssetFactory.getAssetImpl(tenant.id, asset.connectionID);
if (assetImpl) {
// Retrieve Consumption
- const assetConsumptions = await assetImpl.retrieveConsumption(asset);
+ const assetConsumptions = await assetImpl.retrieveConsumptions(asset);
// Create helper for site area limit
const siteAreaLimitConsumption: Consumption = {
startedAt: assetConsumptions[0].lastConsumption.timestamp,

MODIFY
src/server/rest/v1/service/AssetService.ts
src/server/rest/v1/service/AssetService.ts
@@ -176,7 +176,7 @@ export default class AssetService {
});
}
// Retrieve consumption
- const consumptions = await assetImpl.retrieveConsumption(asset, true);
+ const consumptions = await assetImpl.retrieveConsumptions(asset, true);
const consumption = consumptions[0];
// Assign
asset.lastConsumption = consumption.lastConsumption;

retrieveConsumption method in plural