Added getUsersInError endpoint + doc
MODIFY
src/assets/server/rest/v1/docs/e-mobility-oas.json
src/assets/server/rest/v1/docs/e-mobility-oas.json
"$ref": "#/components/parameters/UserIDs"
},
{
- "in": "query",
- "name": "Role",
- "required": false,
- "description": "Role attribute",
- "schema": {
- "type": "string",
- "enum": [
- "S",
- "A",
- "B",
- "D"
- ]
- }
+ "$ref": "#/components/parameters/UserRoles"
},
{
"in": "query",
}
}
},
+ "/api/users/status/in-error": {
+ "get": {
+ "security": [
+ {
+ "bearerAuth": []
+ }
+ ],
+ "description": "Retrieve a list of Users in error",
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/UserRoles"
+ },
+ {
+ "$ref": "#/components/parameters/Search"
+ },
+ {
+ "in": "query",
+ "name": "ErrorType",
+ "required": false,
+ "description": "Pipe separated error types (inactive_user, unassigned_user, inactive_user_account, failed_billing_synchro, no_billing_data)",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "$ref": "#/components/parameters/Skip"
+ },
+ {
+ "$ref": "#/components/parameters/Limit"
+ },
+ {
+ "$ref": "#/components/parameters/SortFields"
+ },
+ {
+ "$ref": "#/components/parameters/OnlyRecordCount"
+ },
+ {
+ "$ref": "#/components/parameters/ProjectFields"
+ }
+ ],
+ "tags": [
+ "Users"
+ ],
+ "responses": {
+ "200": {
+ "description": "Return users in error list",
+ "content": {
+ "application/json": {
+ "example": {
+ "count": 1,
+ "result": [
+ {
+ "email": "###",
+ "createdOn": "2021-04-23T09:08:16.451Z",
+ "firstName": "###",
+ "issuer": true,
+ "name": "###",
+ "status": "P",
+ "role": "B",
+ "errorCode": "inactive_user",
+ "id": "###",
+ "canRead": true,
+ "canUpdate": true,
+ "canDelete": true
+ }
+ ]
+ }
+ }
+ }
+ },
+ "401": {
+ "$ref": "#/components/responses/UnauthorizedError"
+ },
+ "403": {
+ "$ref": "#/components/responses/ForbiddenError"
+ },
+ "500": {
+ "$ref": "#/components/responses/BackendError"
+ }
+ }
+ }
+ },
"/api/tags": {
"get": {
"security": [
"schema": {
"type": "string"
}
+ },
+ "UserRoles": {
+ "in": "query",
+ "name": "Role",
+ "required": false,
+ "description": "Pipe separated user roles (S, A, B, D)",
+ "schema": {
+ "type": "string"
+ }
}
}
}

MODIFY
src/server/rest/v1/router/api/UserRouter.ts
src/server/rest/v1/router/api/UserRouter.ts
@@ -21,6 +21,7 @@ export default class UserRouter {
this.buildRouteUserDefaultCarTag();
this.buildRouteUserGetSites();
this.buildRouteUserSiteAssign();
+ this.buildRouteUserInError();
return this.router;
}
@@ -76,4 +77,10 @@ export default class UserRouter {
await RouterUtils.handleServerAction(UserService.handleAssignSitesToUser.bind(this), ServerAction.ADD_SITES_TO_USER, req, res, next);
});
}
+
+ protected buildRouteUserInError(): void {
+ this.router.get(`/${ServerRoute.REST_USERS_IN_ERROR}`, async (req: Request, res: Response, next: NextFunction) => {
+ await RouterUtils.handleServerAction(UserService.handleGetUsersInError.bind(this), ServerAction.USERS_IN_ERROR, req, res, next);
+ });
+ }
}

MODIFY
src/types/Server.ts
src/types/Server.ts
@@ -498,6 +498,7 @@ export enum ServerRoute {
REST_USER = 'users/:id',
REST_USER_DEFAULT_TAG_CAR = 'users/:id/default-car-tag',
REST_USER_SITES = 'users/:id/sites',
+ REST_USERS_IN_ERROR = 'users/status/in-error',
REST_TAGS = 'tags',
REST_TAG = 'tags/:id',

MODIFY
test/api/client/UserApi.ts
test/api/client/UserApi.ts
import CrudApi from './utils/CrudApi';
+import { ServerRoute } from '../../../src/types/Server';
import TestConstants from './utils/TestConstants';
export default class UserApi extends CrudApi {
@@ -15,7 +16,7 @@ export default class UserApi extends CrudApi {
}
public async readAllInError(params, paging = TestConstants.DEFAULT_PAGING, ordering = TestConstants.DEFAULT_ORDERING) {
- return super.readAll(params, paging, ordering, '/client/api/UsersInError');
+ return super.readAll(params, paging, ordering, `/v1/api/${ServerRoute.REST_USERS_IN_ERROR}`);
}
public async create(data) {

Added getUsersInError endpoint + doc