Use filter method for boolean
MODIFY
src/server/rest/v1/service/security/AssetSecurity.ts
src/server/rest/v1/service/security/AssetSecurity.ts
@@ -28,9 +28,9 @@ export default class AssetSecurity {
const filteredRequest: HttpAssetsRequest = {
Search: sanitize(request.Search),
SiteAreaID: sanitize(request.SiteAreaID),
- WithSiteArea: !request.WithSiteArea ? false : UtilsSecurity.filterBoolean(request.WithSiteArea),
- WithNoSiteArea: !request.WithNoSiteArea ? false : UtilsSecurity.filterBoolean(request.WithNoSiteArea),
- DynamicOnly: !request.DynamicOnly ? false : UtilsSecurity.filterBoolean(request.DynamicOnly),
+ WithSiteArea: UtilsSecurity.filterBoolean(request.WithSiteArea),
+ WithNoSiteArea: UtilsSecurity.filterBoolean(request.WithNoSiteArea),
+ DynamicOnly: UtilsSecurity.filterBoolean(request.DynamicOnly),
ErrorType: sanitize(request.ErrorType)
} as HttpAssetsRequest;
UtilsSecurity.filterSkipAndLimit(request, filteredRequest);
@@ -63,7 +63,7 @@ export default class AssetSecurity {
filteredRequest.name = sanitize(request.name),
filteredRequest.siteAreaID = sanitize(request.siteAreaID),
filteredRequest.assetType = sanitize(request.assetType),
- filteredRequest.excludeFromSmartCharging = sanitize(request.excludeFromSmartCharging);
+ filteredRequest.excludeFromSmartCharging = UtilsSecurity.filterBoolean(sanitize(request.excludeFromSmartCharging));
filteredRequest.fluctuationPercent = sanitize(request.fluctuationPercent),
filteredRequest.staticValueWatt = sanitize(request.staticValueWatt),
filteredRequest.image = request.image;

Use filter method for boolean