Added assets getMany/getOne/create doc
MODIFY
src/assets/server/rest/v1/docs/e-mobility-oas.json
src/assets/server/rest/v1/docs/e-mobility-oas.json
{
"name": "Loggings",
"description": "Loggings API"
+ },
+ {
+ "name": "Assets",
+ "description": "Assets API"
}
],
"paths": {
}
}
}
+ },
+ "/api/assets": {
+ "get": {
+ "security": [
+ {
+ "bearerAuth": []
+ }
+ ],
+ "description": "Get assets list",
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/Search"
+ },
+ {
+ "$ref": "#/components/parameters/Issuer"
+ },
+ {
+ "$ref": "#/components/parameters/SiteAreaIDs"
+ },
+ {
+ "$ref": "#/components/parameters/SiteIDs"
+ },
+ {
+ "$ref": "#/components/parameters/WithSiteArea"
+ },
+ {
+ "$ref": "#/components/parameters/WithNoSiteArea"
+ },
+ {
+ "in": "query",
+ "name": "DynamicOnly",
+ "description": "Dynamic assets only",
+ "schema": {
+ "type": "boolean"
+ }
+ }
+ ],
+ "tags": [
+ "Assets"
+ ],
+ "responses": {
+ "200": {
+ "description": "Return assets list",
+ "content": {
+ "application/json": {
+ "example": {
+ "count": 1,
+ "result": [
+ {
+ "assetType": "###",
+ "connectionID": "###",
+ "coordinates": [
+ 7.01672,
+ 43.6121039
+ ],
+ "currentInstantWatts": 300,
+ "dynamicAsset": true,
+ "issuer": true,
+ "meterID": "###",
+ "name": "###",
+ "siteAreaID": "###",
+ "currentStateOfCharge": 52,
+ "siteID": "###",
+ "id": "###"
+ }
+ ]
+ }
+ }
+ }
+ },
+ "401": {
+ "$ref": "#/components/responses/UnauthorizedError"
+ },
+ "403": {
+ "$ref": "#/components/responses/ForbiddenError"
+ },
+ "500": {
+ "$ref": "#/components/responses/BackendError"
+ }
+ }
+ },
+ "post": {
+ "security": [
+ {
+ "bearerAuth": []
+ }
+ ],
+ "description": "Create an Asset",
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/Asset"
+ }
+ }
+ }
+ },
+ "tags": [
+ "Assets"
+ ],
+ "responses": {
+ "200": {
+ "description": "Asset created successfully",
+ "content": {
+ "application/json": {
+ "example": {
+ "status": "Success",
+ "id": "###"
+ }
+ }
+ }
+ },
+ "401": {
+ "$ref": "#/components/responses/UnauthorizedError"
+ },
+ "403": {
+ "$ref": "#/components/responses/ForbiddenError"
+ },
+ "500": {
+ "$ref": "#/components/responses/BackendError"
+ }
+ }
+ }
+ },
+ "/api/assets/{id}": {
+ "get": {
+ "security": [
+ {
+ "bearerAuth": []
+ }
+ ],
+ "description": "Get asset",
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/assetID"
+ }
+ ],
+ "tags": [
+ "Assets"
+ ],
+ "responses": {
+ "200": {
+ "description": "Return asset",
+ "content": {
+ "application/json": {
+ "example": {
+ "assetType": "###",
+ "connectionID": "123456789",
+ "coordinates": [
+ 7.01672,
+ 43.6121039
+ ],
+ "createdBy": null,
+ "createdOn": "2021-02-03T22:57:34.435Z",
+ "currentConsumptionWh": 3.75,
+ "currentInstantAmps": 1.3043478260869565,
+ "currentInstantAmpsL1": 0,
+ "currentInstantAmpsL2": 0,
+ "currentInstantAmpsL3": 0,
+ "currentInstantVolts": 0,
+ "currentInstantVoltsL1": 0,
+ "currentInstantVoltsL2": 0,
+ "currentInstantVoltsL3": 0,
+ "currentInstantWatts": 300,
+ "currentInstantWattsL1": 0,
+ "currentInstantWattsL2": 0,
+ "currentInstantWattsL3": 0,
+ "dynamicAsset": true,
+ "fluctuationPercent": 5,
+ "issuer": true,
+ "lastChangedBy": null,
+ "meterID": "###",
+ "name": "###",
+ "siteAreaID": "###",
+ "staticValueWatt": 10000,
+ "lastConsumption": {
+ "value": 3.75,
+ "timestamp": "2021-03-05T22:36:00.942Z"
+ },
+ "lastChangedOn": "2021-03-04T10:12:52.514Z",
+ "currentStateOfCharge": 52,
+ "excludeFromSmartCharging": false,
+ "siteID": "###",
+ "id": "###",
+ "siteArea": null
+ }
+ }
+ }
+ },
+ "401": {
+ "$ref": "#/components/responses/UnauthorizedError"
+ },
+ "403": {
+ "$ref": "#/components/responses/ForbiddenError"
+ },
+ "500": {
+ "$ref": "#/components/responses/BackendError"
+ },
+ "550": {
+ "$ref": "#/components/responses/ResourceDoesNotExists"
+ }
+ }
+ }
}
},
"components": {
]
}
}
+ },
+ "Asset": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string"
+ },
+ "siteAreaID": {
+ "type": "string"
+ },
+ "assetType": {
+ "type": "string",
+ "enum": [
+ "CO",
+ "PR",
+ "CO-PR"
+ ]
+ },
+ "excludeFromSmartCharging": {
+ "type": "boolean"
+ },
+ "variationThresholdPercent": {
+ "type": "number"
+ },
+ "fluctuationPercent": {
+ "type": "number"
+ },
+ "staticValueWatt": {
+ "type": "number"
+ },
+ "image": {
+ "type": "string"
+ },
+ "dynamicAsset": {
+ "type": "boolean"
+ },
+ "connectionID": {
+ "type": "string"
+ },
+ "meterID": {
+ "type": "string"
+ },
+ "usePushAPI": {
+ "type": "boolean"
+ },
+ "coordinates": {
+ "type": "array",
+ "items": {
+ "type": "number"
+ },
+ "example": [
+ 0,
+ 0
+ ]
+ }
+ }
}
},
"parameters": {

MODIFY
src/server/rest/v1/router/api/AssetRouter.ts
src/server/rest/v1/router/api/AssetRouter.ts
@@ -41,6 +41,7 @@ export default class AssetRouter {
protected buildRouteGetAsset(): void {
this.router.get(`/${ServerRoute.REST_ASSET}`, async (req: Request, res: Response, next: NextFunction) => {
+ req.query.ID = req.params.id;
await RouterUtils.handleServerAction(AssetService.handleGetAsset.bind(this), ServerAction.ASSET, req, res, next);
});
}

Added assets getMany/getOne/create doc