Fixed company ID not saved on charger
MODIFY
src/server/rest/v1/service/SiteAreaService.ts
src/server/rest/v1/service/SiteAreaService.ts
@@ -69,7 +69,7 @@ export default class SiteAreaService {
// Check and Get Site Area
const authAction = action === ServerAction.ADD_CHARGING_STATIONS_TO_SITE_AREA ? Action.ASSIGN_CHARGING_STATIONS_TO_SITE_AREA : Action.UNASSIGN_CHARGING_STATIONS_TO_SITE_AREA;
const siteArea = await UtilsService.checkAndGetSiteAreaAuthorization(
- req.tenant, req.user, filteredRequest.siteAreaID, authAction, action);
+ req.tenant, req.user, filteredRequest.siteAreaID, authAction, action, { withSite: true });
// Check and Get Charging Stations
const chargingStations = await UtilsService.checkSiteAreaChargingStationsAuthorization(
req.tenant, req.user, siteArea, filteredRequest.chargingStationIDs, action);

MODIFY
src/storage/mongodb/ChargingStationStorage.ts
src/storage/mongodb/ChargingStationStorage.ts
@@ -559,8 +559,9 @@ export default class ChargingStationStorage {
templateHashOcppVendor: chargingStationToSave.templateHashOcppVendor,
issuer: Utils.convertToBoolean(chargingStationToSave.issuer),
public: Utils.convertToBoolean(chargingStationToSave.public),
- siteAreaID: DatabaseUtils.convertToObjectID(chargingStationToSave.siteAreaID),
+ companyID: DatabaseUtils.convertToObjectID(chargingStationToSave.companyID),
siteID: DatabaseUtils.convertToObjectID(chargingStationToSave.siteID),
+ siteAreaID: DatabaseUtils.convertToObjectID(chargingStationToSave.siteAreaID),
chargePointSerialNumber: chargingStationToSave.chargePointSerialNumber,
chargePointModel: chargingStationToSave.chargePointModel,
chargeBoxSerialNumber: chargingStationToSave.chargeBoxSerialNumber,

MODIFY
src/storage/mongodb/SiteAreaStorage.ts
src/storage/mongodb/SiteAreaStorage.ts
@@ -348,8 +348,9 @@ export default class SiteAreaStorage {
{ '_id': { $in: chargingStationIDs } },
{
$set: {
+ companyID: DatabaseUtils.convertToObjectID(siteArea.site?.companyID),
+ siteID: DatabaseUtils.convertToObjectID(siteArea.siteID),
siteAreaID: DatabaseUtils.convertToObjectID(siteArea.id),
- siteID: DatabaseUtils.convertToObjectID(siteArea.siteID)
}
});
}
@@ -372,8 +373,9 @@ export default class SiteAreaStorage {
{ '_id': { $in: chargingStationIDs } },
{
$set: {
+ companyID: null,
+ siteID: null,
siteAreaID: null,
- siteID: null
}
});
}

Fixed company ID not saved on charger