Skip to content

Commit

Permalink
Fixed ChargeBox ID is not an ObjectID
Browse files Browse the repository at this point in the history
  • Loading branch information
FABIANO committed Oct 9, 2018
1 parent b3acdae commit 7c2da08
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
3 changes: 0 additions & 3 deletions src/server/front-end/service/security/SiteSecurity.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,6 @@ class SiteSecurity {
if (site.company) {
filteredSite.company = SiteSecurity.getCompanySecurity().filterCompanyResponse(site.company, loggedUser);;
}
if (site.siteAreas) {
filteredSite.siteAreas = SiteSecurity.getSiteAreaSecurity().filterSiteAreasResponse(site.siteAreas, loggedUser);
}
if (site.users) {
filteredSite.users = site.users.map((user) => {
return SiteSecurity.getUserSecurity().filterMinimalUserResponse(user, loggedUser);
Expand Down
11 changes: 3 additions & 8 deletions src/utils/Database.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,8 @@ class Database {
static updateStatusNotification(src, dest, forFrontEnd=true) {
if (forFrontEnd) {
Database.updateID(src, dest);
dest.chargeBoxID = Database.validateId(src.chargeBoxID);
} else {
dest.chargeBoxID = Utils.convertToObjectID(src.chargeBoxID);
}
dest.chargeBoxID = src.chargeBoxID;
dest.connectorId = Utils.convertToInt(src.connectorId);
dest.timestamp = Utils.convertToDate(src.timestamp);
dest.status = src.status;
Expand Down Expand Up @@ -185,10 +183,8 @@ class Database {
static updateMeterValue(src, dest, forFrontEnd=true) {
if (forFrontEnd) {
Database.updateID(src, dest);
dest.chargeBoxID = Database.validateId(src.chargeBoxID);
} else {
dest.chargeBoxID = Utils.convertToObjectID(src.chargeBoxID);
}
dest.chargeBoxID = src.chargeBoxID
dest.connectorId = Utils.convertToInt(src.connectorId);
dest.transactionId = Utils.convertToInt(src.transactionId);
dest.timestamp = Utils.convertToDate(src.timestamp);
Expand Down Expand Up @@ -428,12 +424,11 @@ class Database {
dest.totalDurationSecs = src.totalDurationSecs;
}
dest.userID = Database.validateId(src.userID);
dest.chargeBoxID = Database.validateId(src.chargeBoxID);
} else {
dest.userID = Utils.convertToObjectID(src.userID);
dest.chargeBoxID = Utils.convertToObjectID(src.chargeBoxID);
}
// ChargeBox
dest.chargeBoxID = src.chargeBoxID
if (forFrontEnd && !Utils.isEmptyJSon(src.chargeBox)) {
dest.chargeBox = {};
Database.updateChargingStation(src.chargeBox, dest.chargeBox);
Expand Down

0 comments on commit 7c2da08

Please sign in to comment.