filter for multiple charing stations
MODIFY
src/integration/smart-charging/sap-smart-charging
src/integration/smart-charging/sap-smart-charging
-Subproject commit 0d0ffb92dff67cb80d2284c0c9be80dbadda446b
+Subproject commit 463263fcb71b048eb0132f8f36db8d2d01b621bf

MODIFY
src/server/rest/service/ChargingStationService.ts
src/server/rest/service/ChargingStationService.ts
-import fs from 'fs';
-
+import { Action, Entity } from '../../../types/Authorization';
+import ChargingStation, { Command, OCPPParams, StaticLimitAmps } from '../../../types/ChargingStation';
+import { HTTPAuthError, HTTPError } from '../../../types/HTTPError';
+import { HttpChargingStationCommandRequest, HttpIsAuthorizedRequest } from '../../../types/requests/HttpChargingStationRequest';
import { NextFunction, Request, Response } from 'express';
-import sanitize from 'mongo-sanitize';
+import { OCPPConfigurationStatus, OCPPGetCompositeScheduleCommandResult, OCPPStatus } from '../../../types/ocpp/OCPPClient';
-import Authorizations from '../../../authorization/Authorizations';
-import ChargingStationClientFactory from '../../../client/ocpp/ChargingStationClientFactory';
import AppAuthError from '../../../exception/AppAuthError';
import AppError from '../../../exception/AppError';
+import Authorizations from '../../../authorization/Authorizations';
import BackendError from '../../../exception/BackendError';
+import { ChargingProfile } from '../../../types/ChargingProfile';
+import ChargingStationClientFactory from '../../../client/ocpp/ChargingStationClientFactory';
+import { ChargingStationInErrorType } from '../../../types/InError';
+import ChargingStationSecurity from './security/ChargingStationSecurity';
+import ChargingStationStorage from '../../../storage/mongodb/ChargingStationStorage';
import ChargingStationVendorFactory from '../../../integration/charging-station-vendor/ChargingStationVendorFactory';
-import SmartChargingFactory from '../../../integration/smart-charging/SmartChargingFactory';
+import Constants from '../../../utils/Constants';
+import { DataResult } from '../../../types/DataResult';
+import I18nManager from '../../../utils/I18nManager';
import LockingHelper from '../../../locking/LockingHelper';
import LockingManager from '../../../locking/LockingManager';
-import ChargingStationStorage from '../../../storage/mongodb/ChargingStationStorage';
+import Logging from '../../../utils/Logging';
import OCPPStorage from '../../../storage/mongodb/OCPPStorage';
-import SiteAreaStorage from '../../../storage/mongodb/SiteAreaStorage';
-import SiteStorage from '../../../storage/mongodb/SiteStorage';
-import TransactionStorage from '../../../storage/mongodb/TransactionStorage';
-import { Action, Entity } from '../../../types/Authorization';
-import { ChargingProfile } from '../../../types/ChargingProfile';
-import ChargingStation, { Command, OCPPParams, StaticLimitAmps } from '../../../types/ChargingStation';
-import { DataResult } from '../../../types/DataResult';
-import { HTTPAuthError, HTTPError } from '../../../types/HTTPError';
-import { ChargingStationInErrorType } from '../../../types/InError';
-import { OCPPConfigurationStatus, OCPPGetCompositeScheduleCommandResult, OCPPStatus } from '../../../types/ocpp/OCPPClient';
-import { HttpChargingStationCommandRequest, HttpIsAuthorizedRequest } from '../../../types/requests/HttpChargingStationRequest';
+import OCPPUtils from '../../ocpp/utils/OCPPUtils';
import { ServerAction } from '../../../types/Server';
import SiteArea from '../../../types/SiteArea';
+import SiteAreaStorage from '../../../storage/mongodb/SiteAreaStorage';
+import SiteStorage from '../../../storage/mongodb/SiteStorage';
+import SmartChargingFactory from '../../../integration/smart-charging/SmartChargingFactory';
import TenantComponents from '../../../types/TenantComponents';
+import TransactionStorage from '../../../storage/mongodb/TransactionStorage';
import UserToken from '../../../types/UserToken';
-import Constants from '../../../utils/Constants';
-import I18nManager from '../../../utils/I18nManager';
-import Logging from '../../../utils/Logging';
import Utils from '../../../utils/Utils';
-import OCPPUtils from '../../ocpp/utils/OCPPUtils';
-import ChargingStationSecurity from './security/ChargingStationSecurity';
import UtilsService from './UtilsService';
+import fs from 'fs';
+import sanitize from 'mongo-sanitize';
const MODULE_NAME = 'ChargingStationService';
@@ -394,7 +393,7 @@ export default class ChargingStationService {
});
}
const chargingProfiles = await ChargingStationStorage.getChargingProfiles(req.user.tenantID,
- { chargingStationID: filteredRequest.ChargeBoxID,
+ { chargingStationIDs: filteredRequest.ChargeBoxID ? filteredRequest.ChargeBoxID.split('|') : null,
connectorID: filteredRequest.ConnectorID,
withChargingStation: filteredRequest.WithChargingStation,
withSiteArea: filteredRequest.WithSiteArea },

MODIFY
src/storage/mongodb/ChargingStationStorage.ts
src/storage/mongodb/ChargingStationStorage.ts
@@ -699,7 +699,7 @@ export default class ChargingStationStorage {
public static async getChargingProfiles(tenantID: string,
params: {
- chargingStationID?: string; connectorID?: number; chargingProfileID?: string;
+ chargingStationIDs?: string[]; connectorID?: number; chargingProfileID?: string;
profilePurposeType?: ChargingProfilePurposeType; transactionId?: number; withChargingStation?: boolean; withSiteArea?: boolean;
} = {},
dbParams: DbParams, projectFields?: string[]): Promise<DataResult<ChargingProfile>> {
@@ -717,8 +717,8 @@ export default class ChargingStationStorage {
filters._id = params.chargingProfileID;
} else {
// Charger
- if (params.chargingStationID) {
- filters.chargingStationID = params.chargingStationID;
+ if (params.chargingStationIDs) {
+ filters.chargingStationID = { $in: params.chargingStationIDs };
}
// Connector
if (params.connectorID) {

filter for multiple charing stations