Added userImport 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/action/import": {
+ "post": {
+ "security": [
+ {
+ "bearerAuth": []
+ }
+ ],
+ "description": "Import users from file",
+ "requestBody": {
+ "content": {
+ "text/csv": {
+ "schema": {
+ "type": "string",
+ "format": "binary"
+ }
+ }
+ }
+ },
+ "tags": [
+ "Users"
+ ],
+ "responses": {
+ "200": {
+ "description": "Users importation results",
+ "content": {
+ "application/json": {
+ "example": {
+ "status": "Success",
+ "inSuccess": 42,
+ "inError": 0
+ }
+ }
+ }
+ },
+ "401": {
+ "$ref": "#/components/responses/UnauthorizedError"
+ },
+ "403": {
+ "$ref": "#/components/responses/ForbiddenError"
+ },
+ "500": {
+ "$ref": "#/components/responses/BackendError"
+ },
+ "583": {
+ "description": "Invalid file format"
+ },
+ "584": {
+ "description": "Invalid CSV header format"
+ }
+ }
+ }
+ },
"/api/tags": {
"get": {
"security": [

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

MODIFY
src/types/Server.ts
src/types/Server.ts
@@ -499,6 +499,7 @@ export enum ServerRoute {
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_USERS_IMPORT = 'users/action/import',
REST_TAGS = 'tags',
REST_TAG = 'tags/:id',

Added userImport endpoint + doc