--- displayed_sidebar: servicesSidebar --- import ParameterTypes from "@site/src/components/ParameterTypes" # UserService Provides layer to manipulate users. ## constructor ### Parameters ___ ## Properties `", "description": "", "optional": true, "defaultValue": "", "expandable": false, "children": [] }, { "name": "__container__", "type": "`any`", "description": "", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "__moduleDeclaration__", "type": "`Record`", "description": "", "optional": true, "defaultValue": "", "expandable": false, "children": [] }, { "name": "analyticsConfigService_", "type": "[AnalyticsConfigService](services.AnalyticsConfigService.mdx)", "description": "", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "eventBus_", "type": "[EventBusService](services.EventBusService.mdx)", "description": "", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "featureFlagRouter_", "type": "`FlagRouter`", "description": "", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "manager_", "type": "`EntityManager`", "description": "", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "transactionManager_", "type": "`undefined` \\| `EntityManager`", "description": "", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "userRepository_", "type": "Repository<[User](../../entities/classes/entities.User.mdx)>", "description": "", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "Events", "type": "`object`", "description": "", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "Events.CREATED", "type": "`string`", "description": "", "optional": false, "defaultValue": "\"user.created\"", "expandable": false, "children": [] }, { "name": "Events.DELETED", "type": "`string`", "description": "", "optional": false, "defaultValue": "\"user.deleted\"", "expandable": false, "children": [] }, { "name": "Events.PASSWORD_RESET", "type": "`string`", "description": "", "optional": false, "defaultValue": "\"user.password_reset\"", "expandable": false, "children": [] }, { "name": "Events.UPDATED", "type": "`string`", "description": "", "optional": false, "defaultValue": "\"user.updated\"", "expandable": false, "children": [] } ]} /> ___ ## Accessors ### activeManager\_ #### Returns ___ ## Methods ### atomicPhase\_ Wraps some work within a transactional block. If the service already has a transaction manager attached this will be reused, otherwise a new transaction manager is created. #### Type Parameters #### Parameters Promise<TResult>", "description": "the transactional work to be done", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "isolationOrErrorHandler", "type": "`IsolationLevel` \\| (`error`: `TError`) => Promise<void \\| TResult>", "description": "the isolation level to be used for the work.", "optional": true, "defaultValue": "", "expandable": false, "children": [] }, { "name": "maybeErrorHandlerOrDontFail", "type": "(`error`: `TError`) => Promise<void \\| TResult>", "description": "Potential error handler", "optional": true, "defaultValue": "", "expandable": false, "children": [] } ]} /> #### Returns ___ ### create Creates a user with username being validated. Fails if email is not a valid format. #### Parameters #### Returns ___ ### delete Deletes a user from a given user id. #### Parameters #### Returns ___ ### generateResetPasswordToken Generate a JSON Web token, that will be sent to a user, that wishes to reset password. The token will be signed with the users current password hash as a secret a long side a payload with userId and the expiry time for the token, which is always 15 minutes. #### Parameters #### Returns ___ ### hashPassword\_ Hashes a password #### Parameters #### Returns ___ ### list #### Parameters #### Returns ___ ### retrieve Gets a user by id. Throws in case of DB Error and if user was not found. #### Parameters #### Returns ___ ### retrieveByApiToken Gets a user by api token. Throws in case of DB Error and if user was not found. #### Parameters #### Returns ___ ### retrieveByEmail Gets a user by email. Throws in case of DB Error and if user was not found. #### Parameters #### Returns ___ ### setPassword\_ Sets a password for a user Fails if no user exists with userId and if the hashing of the new password does not work. #### Parameters #### Returns ___ ### shouldRetryTransaction\_ #### Parameters ` \\| `object`", "description": "", "optional": false, "defaultValue": "", "expandable": false, "children": [] } ]} /> #### Returns ___ ### update Updates a user. #### Parameters #### Returns ___ ### withTransaction #### Parameters #### Returns