Added CS firmware download validation
MODIFY
src/assets/configs-ci
src/assets/configs-ci
-Subproject commit bb476e59dd2d3035922ba131bb490e9d90c7e71d
+Subproject commit a7a9610f28f1138347f70ac4d485e7b9dc1ae7b9

MODIFY
src/assets/configs-scp
src/assets/configs-scp
-Subproject commit a11afe3e14d872278d1ec8ee98801dd5b3be65ee
+Subproject commit cf40aecc4b7c099f6b5b8bc6690f975a6db006b6

MODIFY
src/assets/server/rest/v1/docs/e-mobility-oas.json
src/assets/server/rest/v1/docs/e-mobility-oas.json
"description": "Export Charging Stations as CSV file",
"parameters": [
{
- "$ref": "#/components/parameters/Search"
- },
- {
- "$ref": "#/components/parameters/ChargingStationIDs"
+ "$ref": "#/components/parameters/Issuer"
},
{
- "$ref": "#/components/parameters/Issuer"
+ "$ref": "#/components/parameters/Search"
},
{
"$ref": "#/components/parameters/WithNoSiteArea"
{
"$ref": "#/components/parameters/SiteIDs"
},
- {
- "$ref": "#/components/parameters/WithSite"
- },
{
"$ref": "#/components/parameters/SiteAreaIDs"
},
{
"$ref": "#/components/parameters/ConnectorTypes"
},
+ {
+ "$ref": "#/components/parameters/ChargingStationIDs"
+ },
+ {
+ "$ref": "#/components/parameters/IncludeDeleted"
+ },
{
"$ref": "#/components/parameters/LocLongitude"
},
},
{
"$ref": "#/components/parameters/LocMaxDistanceMeters"
+ },
+ {
+ "$ref": "#/components/parameters/SortFields"
+ },
+ {
+ "$ref": "#/components/parameters/ProjectFields"
}
],
"tags": [

ADD
src/assets/server/rest/v1/schemas/chargingstation/chargingstation-firmware-download.json
+{
+ "title": "Download Charging Station firmware Request",
+ "type": "object",
+ "properties": {
+ "FileName": {
+ "type": "string",
+ "sanitize": "mongo"
+ }
+ },
+ "required": [
+ "FileName"
+ ]
+}

MODIFY
src/server/rest/v1/service/ChargingStationService.ts
src/server/rest/v1/service/ChargingStationService.ts
@@ -1178,7 +1178,7 @@ export default class ChargingStationService {
public static async handleGetFirmware(action: ServerAction, req: Request, res: Response, next: NextFunction): Promise<void> {
// Filter
- const filteredRequest = ChargingStationSecurity.filterChargingStationGetFirmwareRequest(req.query);
+ const filteredRequest = ChargingStationValidator.getInstance().validateChargingStationFirmwareDownloadReq(req.query);
if (!filteredRequest.FileName) {
throw new AppError({
source: Constants.CENTRAL_SERVER,

MODIFY
src/server/rest/v1/validator/ChargingStationValidator.ts
src/server/rest/v1/validator/ChargingStationValidator.ts
-import { HttpChargingStationCommandRequest, HttpChargingStationConnectorRequest, HttpChargingStationOcppRequest, HttpChargingStationsRequest, HttpDownloadQrCodeRequest } from '../../../../types/requests/HttpChargingStationRequest';
+import { HttpChargingStationCommandRequest, HttpChargingStationConnectorRequest, HttpChargingStationGetFirmwareRequest, HttpChargingStationOcppRequest, HttpChargingStationsRequest, HttpDownloadQrCodeRequest } from '../../../../types/requests/HttpChargingStationRequest';
import { ChargingProfile } from '../../../../types/ChargingProfile';
import HttpByIDRequest from '../../../../types/requests/HttpByIDRequest';
@@ -17,6 +17,7 @@ export default class ChargingStationValidator extends SchemaValidator {
private chargingStationQRCodeDownload: Schema;
private chargingStationOcppParametersGet: Schema;
private chargingProfileCreate: Schema;
+ private chargingStationFirmwareDownload: Schema;
private constructor() {
@@ -29,6 +30,7 @@ export default class ChargingStationValidator extends SchemaValidator {
this.chargingStationQRCodeDownload = JSON.parse(fs.readFileSync(`${global.appRoot}/assets/server/rest/v1/schemas/chargingstation/chargingstation-qrcode-download.json`, 'utf8'));
this.chargingStationOcppParametersGet = JSON.parse(fs.readFileSync(`${global.appRoot}/assets/server/rest/v1/schemas/chargingstation/chargingstation-ocpp-parameters-get.json`, 'utf8'));
this.chargingProfileCreate = JSON.parse(fs.readFileSync(`${global.appRoot}/assets/server/rest/v1/schemas/chargingstation/chargingprofile-create.json`, 'utf8'));
+ this.chargingStationFirmwareDownload = JSON.parse(fs.readFileSync(`${global.appRoot}/assets/server/rest/v1/schemas/chargingstation/chargingstation-firmware-download.json`, 'utf8'));
}
public static getInstance(): ChargingStationValidator {
@@ -80,10 +82,15 @@ export default class ChargingStationValidator extends SchemaValidator {
return data;
}
-
public validateChargingProfileCreateReq(data: any): ChargingProfile {
// Validate schema
this.validate(this.chargingProfileCreate, data);
return data;
}
+
+ public validateChargingStationFirmwareDownloadReq(data: any): HttpChargingStationGetFirmwareRequest {
+ // Validate schema
+ this.validate(this.chargingStationFirmwareDownload, data);
+ return data;
+ }
}

Added CS firmware download validation