traiff ID - can now be cleared
MODIFY
src/server/rest/v1/service/security/SiteSecurity.ts
src/server/rest/v1/service/security/SiteSecurity.ts
@@ -112,7 +112,7 @@ export default class SiteSecurity {
name: sanitize(request.name),
address: UtilsSecurity.filterAddressRequest(request.address),
public: UtilsSecurity.filterBoolean(request.public),
- tariffID: request.tariffID ? sanitize(request.tariffID) : null,
+ tariffID: sanitize(request.tariffID),
autoUserSiteAssignment: UtilsSecurity.filterBoolean(request.autoUserSiteAssignment),
companyID: sanitize(request.companyID),
} as Partial<Site>;

MODIFY
src/storage/mongodb/SiteStorage.ts
src/storage/mongodb/SiteStorage.ts
@@ -256,6 +256,7 @@ export default class SiteStorage {
companyID: DatabaseUtils.convertToObjectID(siteToSave.companyID),
autoUserSiteAssignment: Utils.convertToBoolean(siteToSave.autoUserSiteAssignment),
name: siteToSave.name,
+ tariffID: siteToSave.tariffID,
};
if (siteToSave.address) {
siteMDB.address = {
@@ -270,9 +271,6 @@ export default class SiteStorage {
(coordinate) => Utils.convertToFloat(coordinate)) : [],
};
}
- if (siteToSave.tariffID) {
- siteMDB.tariffID = siteToSave.tariffID;
- }
// Add Last Changed/Created props
DatabaseUtils.addLastChangedCreatedProps(siteMDB, siteToSave);
// Modify and return the modified document

traiff ID - can now be cleared