Added getDefaultTagCar endpoint + doc
MODIFY
src/assets/server/rest/v1/docs/e-mobility-oas.json
src/assets/server/rest/v1/docs/e-mobility-oas.json
}
}
},
+ "/api/users/{id}/default-car-tag": {
+ "get": {
+ "security": [
+ {
+ "bearerAuth": []
+ }
+ ],
+ "description": "Get the User's default car tag",
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/userID"
+ }
+ ],
+ "tags": [
+ "Users"
+ ],
+ "responses": {
+ "200": {
+ "description": "Retrieved default car tag and car",
+ "content": {
+ "application/json": {
+ "example": {
+ "tag": {
+ "active": true,
+ "description": "###",
+ "id": "###"
+ },
+ "car": {
+ "licensePlate": "###",
+ "type": "#",
+ "carCatalog": {
+ "vehicleMake": "###",
+ "vehicleModel": "###",
+ "vehicleModelVersion": "###"
+ },
+ "id": "###"
+ }
+ }
+ }
+ }
+ },
+ "401": {
+ "$ref": "#/components/responses/UnauthorizedError"
+ },
+ "403": {
+ "$ref": "#/components/responses/ForbiddenError"
+ },
+ "500": {
+ "$ref": "#/components/responses/BackendError"
+ },
+ "550": {
+ "$ref": "#/components/responses/ResourceDoesNotExists"
+ }
+ }
+ }
+ },
"/api/tags": {
"get": {
"security": [

MODIFY
src/server/rest/v1/router/api/UserRouter.ts
src/server/rest/v1/router/api/UserRouter.ts
@@ -18,6 +18,7 @@ export default class UserRouter {
this.buildRouteCreateUser();
this.buildRouteUpdateUser();
this.buildRouteDeleteUser();
+ this.buildRouteUserDefaultCarTag();
return this.router;
}
@@ -52,4 +53,11 @@ export default class UserRouter {
await RouterUtils.handleServerAction(UserService.handleDeleteUser.bind(this), ServerAction.USER_DELETE, req, res, next);
});
}
+
+ protected buildRouteUserDefaultCarTag(): void {
+ this.router.get(`/${ServerRoute.REST_USER_DEFAULT_TAG_CAR}`, async (req: Request, res: Response, next: NextFunction) => {
+ req.query.UserID = req.params.id;
+ await RouterUtils.handleServerAction(UserService.handleGetUserDefaultTagCar.bind(this), ServerAction.USER_DEFAULT_TAG_CAR, req, res, next);
+ });
+ }
}

MODIFY
src/types/Server.ts
src/types/Server.ts
@@ -494,6 +494,7 @@ export enum ServerRoute {
REST_USERS = 'users',
REST_USER = 'users/:id',
+ REST_USER_DEFAULT_TAG_CAR = 'users/:id/default-car-tag',
REST_TAGS = 'tags',
REST_TAG = 'tags/:id',

Added getDefaultTagCar endpoint + doc