Moved chargers loc coordinates out of the filtering
MODIFY
src/server/rest/v1/service/ChargingStationService.ts
src/server/rest/v1/service/ChargingStationService.ts
@@ -1340,6 +1340,13 @@ export default class ChargingStationService {
}
// Filter
const filteredRequest = ChargingStationValidator.getInstance().validateChargingStationsGetReq(req.query);
+ // Create GPS Coordinates
+ if (filteredRequest.LocLongitude && filteredRequest.LocLatitude) {
+ filteredRequest.LocCoordinates = [
+ Utils.convertToFloat(filteredRequest.LocLongitude),
+ Utils.convertToFloat(filteredRequest.LocLatitude)
+ ];
+ }
// Check Users
let userProject: string[] = [];
if ((await Authorizations.canListUsers(req.user)).authorized) {

MODIFY
src/server/rest/v1/validator/ChargingStationValidator.ts
src/server/rest/v1/validator/ChargingStationValidator.ts
@@ -62,12 +62,6 @@ export default class ChargingStationValidator extends SchemaValidator {
public validateChargingStationsGetReq(data: any): HttpChargingStationsRequest {
// Validate schema
this.validate(this.chargingStationsGet, data);
- if (data.LocLongitude && data.LocLatitude) {
- data.LocCoordinates = [
- Utils.convertToFloat(data.LocLongitude),
- Utils.convertToFloat(data.LocLatitude)
- ];
- }
return data;
}

MODIFY
src/types/requests/HttpChargingStationRequest.ts
src/types/requests/HttpChargingStationRequest.ts
@@ -42,6 +42,8 @@ export interface HttpChargingStationsRequest extends HttpDatabaseRequest {
SiteAreaID?: string;
IncludeDeleted?: boolean;
ErrorType?: string;
+ LocLongitude?: number;
+ LocLatitude?: number;
LocCoordinates?: number[];
LocMaxDistanceMeters?: number;
}

Moved chargers loc coordinates out of the filtering