routing ReserveNow
MODIFY
src/server/rest/v1/router/api/ChargingStationRouter.ts
src/server/rest/v1/router/api/ChargingStationRouter.ts
@@ -48,6 +48,7 @@ export default class ChargingStationRouter {
this.buildRouteChargingStationTriggerSmartCharging();
this.buildRouteChargingStationGetBootNotifications();
this.buildRouteChargingStationGetStatusNotifications();
+ this.buildRouteChargingStationReserveNow();
return this.router;
}
@@ -279,4 +280,10 @@ export default class ChargingStationRouter {
await RouterUtils.handleServerAction(ChargingStationService.handleGetStatusNotifications.bind(this), ServerAction.STATUS_NOTIFICATIONS, req, res, next);
});
}
+
+ protected buildRouteChargingStationReserveNow(): void {
+ this.router.put(`/${ServerRoute.REST_CHARGING_STATIONS_RESERVE_NOW}`, async (req: Request, res: Response, next: NextFunction) => {
+ await RouterUtils.handleServerAction(ChargingStationService.handleReserveNow.bind(this), ServerAction.CHARGING_STATION_RESERVE_NOW, req, res, next);
+ });
+ }
}

MODIFY
src/server/rest/v1/service/ChargingStationService.ts
src/server/rest/v1/service/ChargingStationService.ts
@@ -1081,6 +1081,23 @@ export default class ChargingStationService {
next();
}
+ public static async handleReserveNow(action: ServerAction, req: Request, res: Response, next: NextFunction): Promise<void> {
+ // Check auth
+ if (!await Authorizations.canListChargingStations(req.user)) {
+ throw new AppAuthError({
+ errorCode: HTTPAuthError.FORBIDDEN,
+ user: req.user,
+ action: Action.LIST, entity: Entity.CHARGING_STATIONS,
+ module: MODULE_NAME, method: 'handleReserveNow'
+ });
+ }
+ // Filter
+ const filteredRequest = ChargingStationValidator.getInstance().validateChargingStationActionReserveNowReq(req.query);
+
+
+ next();
+ }
+
public static async handleGetBootNotifications(action: ServerAction, req: Request, res: Response, next: NextFunction): Promise<void> {
// Check auth
if (!await Authorizations.canListChargingStations(req.user)) {

MODIFY
src/types/Server.ts
src/types/Server.ts
@@ -34,6 +34,8 @@ export enum ServerAction {
CHARGING_STATION_UPDATE_PARAMS = 'RestChargingStationUpdateParams',
CHARGING_STATION_LIMIT_POWER = 'RestChargingStationLimitPower',
CHARGING_STATION_DELETE = 'RestChargingStationDelete',
+ CHARGING_STATION_RESERVE_NOW = 'RestChargingStationReserveNpw',
+
CHECK_SMART_CHARGING_CONNECTION = 'RestCheckSmartChargingConnection',
TRIGGER_SMART_CHARGING = 'RestTriggerSmartCharging',
@@ -473,6 +475,7 @@ export enum ServerRoute {
REST_CHARGING_STATIONS_GET_DIAGNOSTICS = 'charging-stations/:id/diagnostics',
REST_CHARGING_STATIONS_FIRMWARE_UPDATE = 'charging-stations/:id/firmware/update',
REST_CHARGING_STATIONS_CHANGE_AVAILABILITY = 'charging-stations/:id/availability/change',
+ REST_CHARGING_STATIONS_RESERVE_NOW = 'charging-stations/:id/reserve/now',
REST_CHARGING_STATIONS_DOWNLOAD_FIRMWARE = 'charging-stations/firmware/download',
REST_CHARGING_STATIONS_QRCODE_GENERATE = 'charging-stations/:id/connectors/:connectorId/qrcode/generate',

routing ReserveNow