added addtitional checks on chargepoint
MODIFY
src/server/rest/v1/service/ChargingStationService.ts
src/server/rest/v1/service/ChargingStationService.ts
@@ -143,17 +143,18 @@ export default class ChargingStationService {
connector.voltage = filteredConnector.voltage;
connector.currentType = filteredConnector.currentType;
connector.numberOfConnectedPhase = filteredConnector.numberOfConnectedPhase;
+ connector.amperageLimit = connector.amperage;
}
connector.phaseAssignmentToGrid = filteredConnector.phaseAssignmentToGrid;
}
}
+ if (chargingStation.manualConfiguration) {
// Existing charge points
- if (!Utils.isEmptyArray(filteredRequest.chargePoints) || !Utils.isEmptyArray(chargingStation.chargePoints)) {
- for (const filteredChargePoint of filteredRequest.chargePoints ? filteredRequest.chargePoints : chargingStation.chargePoints) {
+ if (!Utils.isEmptyArray(filteredRequest.chargePoints)) {
+ for (const filteredChargePoint of filteredRequest.chargePoints) {
const chargePoint = Utils.getChargePointFromID(chargingStation, filteredChargePoint.chargePointID);
// Update Connectors only if manual configuration is enabled
- if (chargePoint && chargingStation.manualConfiguration) {
- chargePoint.chargePointID = filteredChargePoint.chargePointID,
+ if (chargePoint) {
chargePoint.currentType = filteredChargePoint.currentType,
chargePoint.voltage = filteredChargePoint.voltage,
chargePoint.amperage = filteredChargePoint.amperage,
@@ -165,10 +166,16 @@ export default class ChargingStationService {
chargePoint.power = filteredChargePoint.power,
chargePoint.efficiency = filteredChargePoint.efficiency;
chargePoint.connectorIDs = filteredChargePoint.connectorIDs;
- }
+ UtilsService.checkIfChargePointValid(chargingStation, chargePoint, req);
+ } else {
+ chargingStation.chargePoints ? chargingStation.chargePoints.push(filteredChargePoint) : chargingStation.chargePoints = [filteredChargePoint];
UtilsService.checkIfChargePointValid(chargingStation, filteredChargePoint, req);
}
}
+ } else if (Utils.isEmptyArray(filteredRequest.chargePoints) && !Utils.isEmptyArray(chargingStation.chargePoints)) {
+ delete chargingStation.chargePoints;
+ }
+ }
// Update Site Area
if (siteArea) {
// OCPI Site Area

added addtitional checks on chargepoint