Refactored doc
MODIFY
src/assets/server/rest/v1/docs/e-mobility-oas.json
src/assets/server/rest/v1/docs/e-mobility-oas.json
{
"openapi": "3.0.3",
"servers": [
- {
- "description": "Localhost - Development",
- "url": "http://localhost:8080/v1"
- },
{
"description": "SCP - Production system",
"url": "https://sap-ev-rest-server-prod.cfapps.eu10.hana.ondemand.com/v1"
{
"description": "SCP - Quality system",
"url": "https://sap-ev-rest-server-qa.cfapps.eu10.hana.ondemand.com/v1"
+ },
+ {
+ "description": "Localhost - Development",
+ "url": "http://localhost:8080/v1"
}
],
"info": {
"description": "Retrieve a list of Charging Stations",
"parameters": [
{
- "in": "query",
- "name": "Issuer",
- "schema": {
- "type": "boolean"
- }
+ "$ref": "#/components/parameters/Issuer"
},
{
"$ref": "#/components/parameters/Search"
},
{
- "in": "query",
- "name": "WithNoSiteArea",
- "schema": {
- "type": "boolean"
- }
+ "$ref": "#/components/parameters/WithNoSiteArea"
},
{
- "in": "query",
- "name": "SiteID",
- "schema": {
- "type": "string"
- }
+ "$ref": "#/components/parameters/SiteID"
},
{
- "in": "query",
- "name": "WithSite",
- "schema": {
- "type": "boolean"
- }
+ "$ref": "#/components/parameters/WithSite"
},
{
- "in": "query",
- "name": "SiteAreaID",
- "schema": {
- "type": "string"
- }
+ "$ref": "#/components/parameters/SiteAreaID"
},
{
- "in": "query",
- "name": "ConnectorStatus",
- "schema": {
- "type": "string"
- }
+ "$ref": "#/components/parameters/ConnectorStatus"
},
{
- "in": "query",
- "name": "ConnectorType",
- "schema": {
- "type": "string"
- }
+ "$ref": "#/components/parameters/ConnectorType"
},
{
"in": "query",
"name": "ChargeBoxID",
+ "description": "Charging station ID",
"schema": {
"type": "string"
}
},
{
- "in": "query",
- "name": "IncludeDeleted",
- "schema": {
- "type": "boolean"
- }
+ "$ref": "#/components/parameters/IncludeDeleted"
},
{
"$ref": "#/components/parameters/ErrorType"
},
{
- "in": "query",
- "name": "LocLongitude",
- "schema": {
- "type": "number"
- }
+ "$ref": "#/components/parameters/LocLongitude"
},
{
- "in": "query",
- "name": "LocLatitude",
- "schema": {
- "type": "number"
- }
+ "$ref": "#/components/parameters/LocLatitude"
},
{
- "in": "query",
- "name": "LocMaxDistanceMeters",
- "schema": {
- "type": "number"
- }
+ "$ref": "#/components/parameters/LocMaxDistanceMeters"
},
{
"$ref": "#/components/parameters/Limit"
"description": "Retrieve a Charging Station",
"parameters": [
{
- "in": "path",
- "name": "id",
- "required": true,
- "schema": {
- "type": "string"
- }
+ "$ref": "#/components/parameters/ChargingStationID"
}
],
"tags": [
"description": "Delete a Charging Station",
"parameters": [
{
- "in": "path",
- "name": "id",
- "required": true,
- "schema": {
- "type": "string"
- }
+ "$ref": "#/components/parameters/ChargingStationID"
}
],
"tags": [
"description": "Reset a Charging Station",
"parameters": [
{
- "in": "path",
- "name": "id",
- "required": true,
- "schema": {
- "type": "string"
- }
+ "$ref": "#/components/parameters/ChargingStationID"
},
{
- "in": "path",
+ "in": "query",
"name": "type",
"required": true,
+ "description": "Reset type",
"schema": {
"type": "string",
- "enum": ["Soft", "Hard"],
+ "enum": [
+ "Soft",
+ "Hard"
+ ],
"example": "Soft"
}
}
"description": "Clear a Charging Station cache",
"parameters": [
{
- "in": "path",
- "name": "id",
- "required": true,
- "schema": {
- "type": "string"
- }
+ "$ref": "#/components/parameters/ChargingStationID"
}
],
"tags": [
"description": "Get a Charging Station configuration",
"parameters": [
{
- "in": "path",
- "name": "id",
- "required": true,
- "schema": {
- "type": "string"
- }
+ "$ref": "#/components/parameters/ChargingStationID"
},
{
"in": "query",
"name": "key",
+ "description": "Configuration key",
"schema": {
"type": "string"
}
"description": "Download connector QRCode as PDF",
"parameters": [
{
- "in": "path",
- "name": "id",
- "required": true,
- "schema": {
- "type": "string"
- }
+ "$ref": "#/components/parameters/ChargingStationID"
},
{
"$ref": "#/components/parameters/ConnectorID"
},
{
- "in": "path",
- "name": "SiteAreaID",
- "required": true,
- "schema": {
- "type": "string"
- }
+ "$ref": "#/components/parameters/SiteAreaID"
},
{
- "in": "path",
- "name": "SiteID",
- "required": true,
- "schema": {
- "type": "string"
- }
+ "$ref": "#/components/parameters/SiteID"
}
],
"tags": [
"description": "Get Charging Station composite schedule",
"parameters": [
{
- "in": "path",
- "name": "id",
- "required": true,
- "schema": {
- "type": "string"
- }
+ "$ref": "#/components/parameters/ChargingStationID"
}
],
"tags": [
"description": "Get Charging Station diagnostics",
"parameters": [
{
- "in": "path",
- "name": "id",
- "required": true,
- "schema": {
- "type": "string"
- }
+ "$ref": "#/components/parameters/ChargingStationID"
},
{
"in": "path",
"name": "location",
"required": true,
+ "description": "Location",
"schema": {
"type": "string"
}
},
{
- "in": "path",
+ "in": "query",
"name": "retries",
+ "description": "Number of retries",
"schema": {
- "type": "number"
+ "type": "integer"
}
},
{
- "in": "path",
+ "in": "query",
"name": "retryInterval",
+ "description": "Retry interval",
"schema": {
"type": "number"
}
},
{
- "in": "path",
+ "in": "query",
"name": "startTime",
+ "description": "Start time",
"schema": {
- "type": "string"
+ "type": "string",
+ "format": "date-time"
}
},
{
- "in": "path",
+ "in": "query",
"name": "stopTime",
+ "description": "Stop time",
"schema": {
- "type": "string"
+ "type": "string",
+ "format": "date-time"
}
}
],
"description": "Get Charging Station OCPP Parameters",
"parameters": [
{
- "in": "path",
- "required": true,
- "name": "id",
- "schema": {
- "type": "string"
- }
+ "$ref": "#/components/parameters/ChargingStationID"
}
],
"tags": [
"description": "Export Charging Station OCPP Parameters as CSV file",
"parameters": [
{
- "in": "path",
- "required": true,
- "name": "id",
- "schema": {
- "type": "string"
- }
+ "$ref": "#/components/parameters/ChargingStationID"
}
],
"tags": [
"description": "Get Charging Station transactions",
"parameters": [
{
- "in": "path",
- "name": "id",
- "required": true,
- "schema": {
- "type": "string"
- }
- },
- {
- "in": "query",
- "name": "Issuer",
- "required": false,
- "schema": {
- "type": "boolean"
- }
+ "$ref": "#/components/parameters/ChargingStationID"
},
{
- "in": "query",
- "name": "ChargeBoxID",
- "required": false,
- "schema": {
- "type": "string"
- }
+ "$ref": "#/components/parameters/Issuer"
},
{
"in": "query",
"name": "StartDateTime",
"required": false,
+ "description": "Start date time",
"schema": {
"type": "string",
"format": "date-time"
"in": "query",
"name": "EndDateTime",
"required": false,
+ "description": "End date time",
"schema": {
"type": "string",
"format": "date-time"
}
},
{
- "in": "query",
- "name": "SiteID",
- "required": false,
- "schema": {
- "type": "string"
- }
+ "$ref": "#/components/parameters/SiteID"
},
{
"in": "query",
"name": "TagID",
+ "description": "Tag ID",
"required": false,
"schema": {
"type": "string"
}
},
{
- "in": "query",
- "name": "SiteAreaID",
- "required": false,
- "schema": {
- "type": "string"
- }
+ "$ref": "#/components/parameters/SiteAreaID"
},
{
- "in": "query",
- "name": "Search",
- "required": false,
- "schema": {
"$ref": "#/components/parameters/Search"
- }
},
{
"in": "query",
"name": "InactivityStatus",
"required": false,
+ "description": "Inactivity status",
"schema": {
"type": "string"
}
"in": "query",
"name": "RefundStatus",
"required": false,
+ "description": "Refund status",
"schema": {
"type": "string"
}
"in": "query",
"name": "MinimalPrice",
"required": false,
+ "description": "Minimal price",
"schema": {
"type": "number"
}
"in": "query",
"name": "Statistics",
"required": false,
+ "description": "Statistics",
"schema": {
"type": "string"
}
"in": "query",
"name": "UserID",
"required": false,
- "description": "Pipe separated IDs",
+ "description": "Pipe separated User IDs",
"schema": {
"type": "string"
}
"in": "query",
"name": "ReportIDs",
"required": false,
- "description": "Pipe separated IDs",
+ "description": "Pipe separated Report IDs",
"schema": {
"type": "string"
}
},
{
- "in": "query",
- "name": "Skip",
- "required": false,
- "schema": {
"$ref": "#/components/parameters/Skip"
- }
},
{
- "in": "query",
- "name": "Limit",
- "required": false,
- "schema": {
"$ref": "#/components/parameters/Limit"
- }
},
{
- "in": "query",
- "name": "SortFields",
- "required": false,
- "schema": {
"$ref": "#/components/parameters/SortFields"
}
- }
],
"tags": [
"Charging Stations"
"description": "Get Charging Station in error",
"parameters": [
{
- "in": "query",
- "name": "Issuer",
- "schema": {
- "type": "boolean"
- }
+ "$ref": "#/components/parameters/Issuer"
},
{
"$ref": "#/components/parameters/Search"
},
{
- "in": "query",
- "name": "WithNoSiteArea",
- "schema": {
- "type": "boolean"
- }
+ "$ref": "#/components/parameters/WithNoSiteArea"
},
{
- "in": "query",
- "name": "SiteID",
- "schema": {
- "type": "string"
- }
+ "$ref": "#/components/parameters/SiteID"
},
{
"in": "query",
"name": "WithNoSite",
+ "description": "With no site",
"schema": {
"type": "boolean"
}
},
{
- "in": "query",
- "name": "SiteAreaID",
- "schema": {
- "type": "boolean"
- }
+ "$ref": "#/components/parameters/SiteAreaID"
},
{
- "in": "query",
- "name": "ConnectorStatus",
- "schema": {
- "type": "string"
- }
+ "$ref": "#/components/parameters/ConnectorStatus"
},
{
- "in": "query",
- "name": "ConnectorType",
- "schema": {
- "type": "string"
- }
+ "$ref": "#/components/parameters/ConnectorType"
},
{
"in": "query",
"name": "ChargeBoxID",
+ "description": "Charging Sation ID",
"schema": {
"type": "string"
}
},
{
- "in": "query",
- "name": "IncludeDeleted",
- "schema": {
- "type": "boolean"
- }
+ "$ref": "#/components/parameters/IncludeDeleted"
},
{
"$ref": "#/components/parameters/ErrorType"
},
{
- "in": "query",
- "name": "LocLongitude",
- "schema": {
- "type": "string"
- }
+ "$ref": "#/components/parameters/LocLongitude"
},
{
- "in": "query",
- "name": "LocLatitude",
- "schema": {
- "type": "string"
- }
+ "$ref": "#/components/parameters/LocLatitude"
},
{
- "in": "query",
- "name": "LocMaxDistanceMeters",
- "schema": {
- "type": "number",
- "minimum": 0
- }
+ "$ref": "#/components/parameters/LocMaxDistanceMeters"
},
{
"$ref": "#/components/parameters/Skip"
"description": "Export Charging Stations as CSV file",
"parameters": [
{
- "in": "query",
- "name": "Issuer",
- "schema": {
- "type": "boolean"
- }
+ "$ref": "#/components/parameters/Issuer"
},
{
"$ref": "#/components/parameters/Search"
},
{
- "in": "query",
- "name": "WithNoSiteArea",
- "schema": {
- "type": "boolean"
- }
+ "$ref": "#/components/parameters/WithNoSiteArea"
},
{
- "in": "query",
- "name": "SiteID",
- "schema": {
- "type": "string"
- }
+ "$ref": "#/components/parameters/SiteID"
},
{
- "in": "query",
- "name": "WithSite",
- "schema": {
- "type": "boolean"
- }
+ "$ref": "#/components/parameters/WithSite"
},
{
- "in": "query",
- "name": "SiteAreaID",
- "schema": {
- "type": "string"
- }
+ "$ref": "#/components/parameters/SiteAreaID"
},
{
- "in": "query",
- "name": "ConnectorStatus",
- "schema": {
- "type": "string"
- }
+ "$ref": "#/components/parameters/ConnectorStatus"
},
{
- "in": "query",
- "name": "ConnectorType",
- "schema": {
- "type": "string"
- }
+ "$ref": "#/components/parameters/ConnectorType"
},
{
"in": "query",
"name": "ChargeBoxID",
+ "description": "Charging Station ID",
"schema": {
"type": "string"
}
},
{
- "in": "query",
- "name": "IncludeDeleted",
- "schema": {
- "type": "boolean"
- }
+ "$ref": "#/components/parameters/IncludeDeleted"
},
{
"$ref": "#/components/parameters/ErrorType"
},
{
- "in": "query",
- "name": "LocLongitude",
- "schema": {
- "type": "number"
- }
+ "$ref": "#/components/parameters/LocLongitude"
},
{
- "in": "query",
- "name": "LocLatitude",
- "schema": {
- "type": "string"
- }
+ "$ref": "#/components/parameters/LocLatitude"
},
{
- "in": "query",
- "name": "LocMaxDistanceMeters",
- "schema": {
- "type": "number"
- }
+ "$ref": "#/components/parameters/LocMaxDistanceMeters"
}
],
"tags": [
],
"responses": {
"200": {
+ "description": "Samrt Charging is enabled"
},
"401": {
"$ref": "#/components/responses/UnauthorizedError"
{
"in": "query",
"name": "ChargeBoxID",
+ "description": "Charging Station ID",
"schema": {
"type": "string"
}
},
{
- "in": "query",
- "name": "ConnectorID",
- "schema": {
- "type": "string"
- }
+ "$ref": "#/components/parameters/ConnectorID"
},
{
"in": "query",
"name": "WithChargingStation",
+ "description": "With Charging Station attribute",
"schema": {
"type": "boolean"
}
{
"in": "query",
"name": "WithSiteArea",
+ "description": "With Site Area",
"schema": {
"type": "boolean"
}
},
{
- "in": "query",
- "name": "SiteID",
- "schema": {
- "type": "string"
- }
+ "$ref": "#/components/parameters/SiteID"
},
{
"$ref": "#/components/parameters/Skip"
"description": "Delete a Charging Station profile",
"parameters": [
{
- "in": "path",
- "name": "id",
- "required": true,
- "schema": {
- "type": "string"
- }
+ "$ref": "#/components/parameters/ChargingStationID"
}
],
"tags": [
},
"ChargingProfile": {
"type": "object",
- "required": ["chargingStationID", "chargePointID", "profile"],
+ "required": [
+ "chargingStationID",
+ "chargePointID",
+ "profile"
+ ],
"properties": {
"id": {
"type": "string"
},
"profile": {
"type": "object",
- "required": ["chargingProfileId", "stackLevel", "chargingProfilePurpose", "chargingProfileKind", "chargingSchedule"],
+ "required": [
+ "chargingProfileId",
+ "stackLevel",
+ "chargingProfilePurpose",
+ "chargingProfileKind",
+ "chargingSchedule"
+ ],
"properties": {
"chargingProfileId": {
"type": "number"
},
"chargingProfilePurpose": {
"type": "string",
- "enum": ["ChargePointMaxProfile", "TxDefaultProfile", "TxProfile"]
+ "enum": [
+ "ChargePointMaxProfile",
+ "TxDefaultProfile",
+ "TxProfile"
+ ]
},
"chargingProfileKind": {
"type": "string",
- "enum": ["Absolute", "Recurring", "Relative"]
+ "enum": [
+ "Absolute",
+ "Recurring",
+ "Relative"
+ ]
},
"recurrencyKind": {
"type": "string",
- "enum": ["Daily", "Weekly"]
+ "enum": [
+ "Daily",
+ "Weekly"
+ ]
},
"validFrom": {
"type": "string",
"ErrorType": {
"in": "query",
"name": "ErrorType",
+ "description": "Error type",
"schema": {
"type": "string",
- "enum": ["missing_settings", "connection_broken", "missing_site_area", "connection_error"]
+ "enum": [
+ "missing_settings",
+ "connection_broken",
+ "missing_site_area",
+ "connection_error"
+ ]
+ }
+ },
+ "ChargingStationID": {
+ "in": "path",
+ "name": "id",
+ "description": "Charging station ID",
+ "required": true,
+ "schema": {
+ "type": "string"
}
},
"ConnectorID": {
"in": "path",
"name": "connectorId",
"required": true,
+ "description": "Connector ID",
"schema": {
"type": "integer",
"minimum": 1,
"example": 1
}
+ },
+ "SiteID": {
+ "in": "query",
+ "name": "SiteID",
+ "description": "Site ID",
+ "schema": {
+ "type": "string"
+ }
+ },
+ "SiteAreaID": {
+ "in": "query",
+ "name": "SiteAreaID",
+ "description": "Site Area ID",
+ "schema": {
+ "type": "string"
+ }
+ },
+ "Issuer": {
+ "in": "query",
+ "name": "Issuer",
+ "description": "Current organization",
+ "schema": {
+ "type": "boolean"
+ }
+ },
+ "IncludeDeleted": {
+ "in": "query",
+ "name": "IncludeDeleted",
+ "description": "Include deleted charging stations",
+ "schema": {
+ "type": "boolean"
+ }
+ },
+ "ConnectorStatus": {
+ "in": "query",
+ "name": "ConnectorStatus",
+ "description": "Connector status",
+ "schema": {
+ "type": "string"
+ }
+ },
+ "ConnectorType": {
+ "in": "query",
+ "name": "ConnectorType",
+ "description": "Connector type",
+ "schema": {
+ "type": "string"
+ }
+ },
+ "LocLongitude": {
+ "in": "query",
+ "name": "LocLongitude",
+ "description": "Longitude location",
+ "schema": {
+ "type": "number"
+ }
+ },
+ "LocLatitude": {
+ "in": "query",
+ "name": "LocLatitude",
+ "description": "Latitude location",
+ "schema": {
+ "type": "string"
+ }
+ },
+ "LocMaxDistanceMeters": {
+ "in": "query",
+ "name": "LocMaxDistanceMeters",
+ "description": "Maximum range from location in meters",
+ "schema": {
+ "type": "number"
+ }
+ },
+ "WithNoSiteArea": {
+ "in": "query",
+ "name": "WithNoSiteArea",
+ "description": "With no Site Area",
+ "schema": {
+ "type": "boolean"
+ }
+ },
+ "WithSite": {
+ "in": "query",
+ "name": "WithSite",
+ "description": "With site attribute",
+ "schema": {
+ "type": "boolean"
+ }
}
}
}

MODIFY
src/server/rest/v1/router/api/ChargingStationRouter.ts
src/server/rest/v1/router/api/ChargingStationRouter.ts
@@ -51,7 +51,7 @@ export default class ChargingStationRouter {
}
protected buildRouteChargingStation(): void {
- this.router.get(`/${ServerRoute.REST_CHARGING_STATIONS}/:id`, async (req: Request, res: Response, next: NextFunction) => {
+ 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);
});

MODIFY
src/server/rest/v1/router/doc/SwaggerRouter.ts
src/server/rest/v1/router/doc/SwaggerRouter.ts
@@ -4,8 +4,7 @@ import global from '../../../../../types/GlobalType';
import swaggerUi from 'swagger-ui-express';
const options = {
- explorer: false,
- apis: ['src/assets/server/rest/v1/docs/*.json'],
+ explorer: false
};
export default class SwaggerRouter {

MODIFY
src/server/rest/v1/service/ChargingStationService.ts
src/server/rest/v1/service/ChargingStationService.ts
@@ -994,7 +994,6 @@ export default class ChargingStationService {
public static async handleAction(action: ServerAction, req: Request, res: Response, next: NextFunction) {
// Filter - Type is hacked because code below is. Would need approval to change code structure.
- // const command = action.substr(ServerAction.REST_CHARGING_STATIONS.length) as Command;
const command = action.slice(15) as Command;
const filteredRequest: HttpChargingStationCommandRequest =

MODIFY
src/types/Server.ts
src/types/Server.ts
@@ -399,6 +399,7 @@ export enum ServerRoute {
REST_MAIL_RESEND = 'mail/resend',
REST_CHARGING_STATIONS = 'chargingstations',
+ REST_CHARGING_STATION = 'chargingstations/:id',
REST_CHARGING_STATIONS_RESET = 'chargingstations/:id/reset',
REST_CHARGING_STATIONS_CACHE_CLEAR = 'chargingstations/:id/cache/clear',
REST_CHARGING_STATIONS_CONFIGURATION = 'chargingstations/:id/configuration',

Refactored doc