Rolled back query IDs
MODIFY
src/assets/server/rest/v1/schemas/chargingstation/chargingstation-delete.json
src/assets/server/rest/v1/schemas/chargingstation/chargingstation-delete.json
"title": "Delete a Charging Station",
"type": "object",
"properties": {
- "id": {
+ "ID": {
"$ref": "chargingstation.json#/definitions/id"
}
},
"required": [
- "id"
+ "ID"
]
}

MODIFY
src/assets/server/rest/v1/schemas/chargingstation/chargingstation-get.json
src/assets/server/rest/v1/schemas/chargingstation/chargingstation-get.json
"title": "Get one Charging Station",
"type": "object",
"properties": {
- "id": {
+ "ID": {
"$ref": "chargingstation.json#/definitions/id"
},
"ProjectFields": {
}
},
"required": [
- "id"
+ "ID"
]
}

MODIFY
src/server/rest/v1/router/api/ChargingStationRouter.ts
src/server/rest/v1/router/api/ChargingStationRouter.ts
@@ -55,12 +55,14 @@ export default class ChargingStationRouter {
protected buildRouteChargingStation(): void {
this.router.get(`/${ServerRoute.REST_CHARGING_STATION}`, async (req: Request, res: Response, next: NextFunction) => {
+ req.query.ID = req.params.id;
await RouterUtils.handleServerAction(ChargingStationService.handleGetChargingStation.bind(this), ServerAction.CHARGING_STATION, req, res, next);
});
}
protected buildRouteChargingStationDelete(): void {
this.router.delete(`/${ServerRoute.REST_CHARGING_STATIONS}/:id`, async (req: Request, res: Response, next: NextFunction) => {
+ req.query.ID = req.params.id;
await RouterUtils.handleServerAction(ChargingStationService.handleDeleteChargingStation.bind(this), ServerAction.CHARGING_STATION_DELETE, req, res, next);
});
}

MODIFY
src/server/rest/v1/service/ChargingStationService.ts
src/server/rest/v1/service/ChargingStationService.ts
@@ -695,7 +695,7 @@ export default class ChargingStationService {
public static async handleDeleteChargingStation(action: ServerAction, req: Request, res: Response, next: NextFunction): Promise<void> {
// Filter
- const chargingStationID = ChargingStationValidator.getInstance().validateChargingStationDeleteReq(req.params).id;
+ const chargingStationID = ChargingStationValidator.getInstance().validateChargingStationDeleteReq(req.params).ID;
// Check Mandatory fields
UtilsService.assertIdIsProvided(action, chargingStationID, MODULE_NAME,
'handleDeleteChargingStation', req.user);
@@ -819,7 +819,7 @@ export default class ChargingStationService {
public static async handleGetChargingStation(action: ServerAction, req: Request, res: Response, next: NextFunction): Promise<void> {
// Filter
const filteredRequest = ChargingStationValidator.getInstance().validateChargingStationGetReq({ ...req.params, ...req.query });
- UtilsService.assertIdIsProvided(action, filteredRequest.id, MODULE_NAME, 'handleGetChargingStation', req.user);
+ UtilsService.assertIdIsProvided(action, filteredRequest.ID, MODULE_NAME, 'handleGetChargingStation', req.user);
// Check auth
if (!Authorizations.canReadChargingStation(req.user)) {
throw new AppAuthError({
@@ -827,7 +827,7 @@ export default class ChargingStationService {
user: req.user,
action: Action.READ, entity: Entity.CHARGING_STATION,
module: MODULE_NAME, method: 'handleGetChargingStation',
- value: filteredRequest.id
+ value: filteredRequest.ID
});
}
let projectFields = [
@@ -845,15 +845,15 @@ export default class ChargingStationService {
}
// Query charging station
const chargingStation = await ChargingStationStorage.getChargingStation(
- req.user.tenantID, filteredRequest.id, {}, projectFields);
- UtilsService.assertObjectExists(action, chargingStation, `Charging Station '${filteredRequest.id}' does not exist`,
+ req.user.tenantID, filteredRequest.ID, {}, projectFields);
+ UtilsService.assertObjectExists(action, chargingStation, `Charging Station '${filteredRequest.ID}' does not exist`,
MODULE_NAME, 'handleGetChargingStation', req.user);
// Deleted?
if (chargingStation.deleted) {
throw new AppError({
source: Constants.CENTRAL_SERVER,
errorCode: HTTPError.OBJECT_DOES_NOT_EXIST_ERROR,
- message: `ChargingStation with ID '${filteredRequest.id}' is logically deleted`,
+ message: `ChargingStation with ID '${filteredRequest.ID}' is logically deleted`,
module: MODULE_NAME,
method: 'handleGetChargingStation',
user: req.user

MODIFY
src/server/rest/v1/validator/ChargingStationValidator.ts
src/server/rest/v1/validator/ChargingStationValidator.ts
import { HttpChargingStationCommandRequest, HttpChargingStationsRequest } from '../../../../types/requests/HttpChargingStationRequest';
-import { HttpRestByIDRequest } from '../../../../types/requests/HttpByIDRequest';
+import HttpByIDRequest from '../../../../types/requests/HttpByIDRequest';
import Schema from './Schema';
import SchemaValidator from './SchemaValidator';
import fs from 'fs';
@@ -35,13 +35,13 @@ export default class ChargingStationValidator extends SchemaValidator {
return data;
}
- public validateChargingStationGetReq(data: any): HttpRestByIDRequest {
+ public validateChargingStationGetReq(data: any): HttpByIDRequest {
// Validate schema
this.validate(this.chargingStationGet, data);
return data;
}
- public validateChargingStationDeleteReq(data: any): HttpRestByIDRequest {
+ public validateChargingStationDeleteReq(data: any): HttpByIDRequest {
// Validate schema
this.validate(this.chargingStationDelete, data);
return data;

MODIFY
src/types/requests/HttpByIDRequest.ts
src/types/requests/HttpByIDRequest.ts
@@ -3,7 +3,3 @@ import { HttpDatabaseProjectRequest } from './HttpDatabaseRequest';
export default interface HttpByIDRequest extends HttpDatabaseProjectRequest {
ID: string;
}
-
-export interface HttpRestByIDRequest extends HttpDatabaseProjectRequest {
- id: string;
-}

Rolled back query IDs