schema for ReserveNow
ADD
src/assets/server/rest/v1/schemas/chargingstation/chargingstation-action-reserve-now.json
+{
+ "title": "Reserve Now",
+ "type": "object",
+ "properties": {
+ "chargingStationID": {
+ "$ref": "chargingstation.json#/definitions/id"
+ },
+ "args": {
+ "type": "object",
+ "properties": {
+ "connectorId": {
+ "$ref": "chargingstation.json#/definitions/connector/properties/connectorId"
+ },
+ "expiryDate": {
+ "type": "date",
+ "sanitize": "mongo"
+ },
+ "idTag": {
+ "$ref": "tag.json#/definitions/id"
+ },
+ "parentIdTag": {
+ "$ref": "tag.json#/definitions/id"
+ },
+ "reservationId": {
+ "type": "number",
+ "sanitize": "mongo"
+ }
+ },
+ "required": [
+ "connectorId",
+ "expiryDate",
+ "idTag",
+ "reservationId"
+ ]
+ }
+ },
+ "required": [
+ "chargingStationID"
+ ]
+}

MODIFY
src/server/rest/v1/validator/ChargingStationValidator.ts
src/server/rest/v1/validator/ChargingStationValidator.ts
-import { HttpChargingProfilesRequest, HttpChargingStationChangeAvailabilityRequest, HttpChargingStationChangeConfigurationRequest, HttpChargingStationClearCacheRequest, HttpChargingStationCommandDataTransferRequest, HttpChargingStationCommandRequest, HttpChargingStationCommandUnlockConnectorRequest, HttpChargingStationConnectorRequest, HttpChargingStationGetCompositeScheduleRequest, HttpChargingStationGetDiagnosticsRequest, HttpChargingStationGetFirmwareRequest, HttpChargingStationLimitPowerRequest, HttpChargingStationOcppParametersRequest, HttpChargingStationOcppRequest, HttpChargingStationParamsUpdateRequest, HttpChargingStationRequest, HttpChargingStationResetRequest, HttpChargingStationStartTransactionRequest, HttpChargingStationStopTransactionRequest, HttpChargingStationUpdateFirmwareRequest, HttpChargingStationsInErrorRequest, HttpChargingStationsRequest, HttpDownloadQrCodeRequest, HttpTriggerSmartChargingRequest } from '../../../../types/requests/HttpChargingStationRequest';
+import { HttpChargingProfilesRequest, HttpChargingStationChangeAvailabilityRequest, HttpChargingStationChangeConfigurationRequest, HttpChargingStationClearCacheRequest, HttpChargingStationCommandDataTransferRequest, HttpChargingStationCommandRequest, HttpChargingStationCommandUnlockConnectorRequest, HttpChargingStationConnectorRequest, HttpChargingStationGetCompositeScheduleRequest, HttpChargingStationGetDiagnosticsRequest, HttpChargingStationGetFirmwareRequest, HttpChargingStationLimitPowerRequest, HttpChargingStationOcppParametersRequest, HttpChargingStationOcppRequest, HttpChargingStationParamsUpdateRequest, HttpChargingStationRequest, HttpChargingStationReserveNowRequest, HttpChargingStationResetRequest, HttpChargingStationStartTransactionRequest, HttpChargingStationStopTransactionRequest, HttpChargingStationUpdateFirmwareRequest, HttpChargingStationsInErrorRequest, HttpChargingStationsRequest, HttpDownloadQrCodeRequest, HttpTriggerSmartChargingRequest } from '../../../../types/requests/HttpChargingStationRequest';
import { ChargingProfile } from '../../../../types/ChargingProfile';
import HttpDatabaseRequest from '../../../../types/requests/HttpDatabaseRequest';
@@ -22,6 +22,7 @@ export default class ChargingStationValidator extends SchemaValidator {
private chargingStationActionGetCompositeSchedule: Schema;
private chargingStationActionUnlockConnector: Schema;
private chargingStationActionUpdateFirmware: Schema;
+ private chargingStationActionReserveNow: Schema;
private chargingStationActionReset: Schema;
private chargingStationQRCodeGenerate: Schema;
private chargingStationQRCodeDownload: Schema;
@@ -54,6 +55,7 @@ export default class ChargingStationValidator extends SchemaValidator {
this.chargingStationActionGetCompositeSchedule = JSON.parse(fs.readFileSync(`${global.appRoot}/assets/server/rest/v1/schemas/chargingstation/chargingstation-action-get-composite-schedule.json`, 'utf8'));
this.chargingStationActionUnlockConnector = JSON.parse(fs.readFileSync(`${global.appRoot}/assets/server/rest/v1/schemas/chargingstation/chargingstation-action-unlock-connector.json`, 'utf8'));
this.chargingStationActionUpdateFirmware = JSON.parse(fs.readFileSync(`${global.appRoot}/assets/server/rest/v1/schemas/chargingstation/chargingstation-action-update-firmware.json`, 'utf8'));
+ this.chargingStationActionReserveNow = JSON.parse(fs.readFileSync(`${global.appRoot}/assets/server/rest/v1/schemas/chargingstation/chargingstation-action-reserve-now.json`, 'utf8'));
this.chargingStationActionReset = JSON.parse(fs.readFileSync(`${global.appRoot}/assets/server/rest/v1/schemas/chargingstation/chargingstation-action-reset.json`, 'utf8'));
this.chargingStationQRCodeGenerate = JSON.parse(fs.readFileSync(`${global.appRoot}/assets/server/rest/v1/schemas/chargingstation/chargingstation-qrcode-generate.json`, 'utf8'));
this.chargingStationQRCodeDownload = JSON.parse(fs.readFileSync(`${global.appRoot}/assets/server/rest/v1/schemas/chargingstation/chargingstation-qrcode-download.json`, 'utf8'));
@@ -157,6 +159,12 @@ export default class ChargingStationValidator extends SchemaValidator {
return data;
}
+ public validateChargingStationActionReserveNowReq(data: any): HttpChargingStationReserveNowRequest {
+ // Validate schema for Reserve Now
+ this.validate(this.chargingStationActionReserveNow, data);
+ return data;
+ }
+
public validateChargingStationActionResetReq(data: any): HttpChargingStationResetRequest {
// Validate schema for Reset
this.validate(this.chargingStationActionReset, data);

MODIFY
src/types/requests/HttpChargingStationRequest.ts
src/types/requests/HttpChargingStationRequest.ts
@@ -184,6 +184,17 @@ export interface HttpChargingStationUpdateFirmwareRequest {
}
}
+export interface HttpChargingStationReserveNowRequest {
+ chargingStationID: string,
+ args: {
+ connectorId: string;
+ expiryDate: Date;
+ idTag: string;
+ parentIdTag?: string;
+ reservationId: string;
+ }
+}
+
export interface HttpChargingStationResetRequest {
chargingStationID: string,
args: {

schema for ReserveNow