Class BaseUsersService<U, UR>

A UsersService is a component of your application's backend that provides programmatic access to the Users API. It typically includes methods for creating, retrieving, updating, and deleting user entities, as well as managing user permissions and roles.

Type Parameters

Constructors

Properties

dataSource: DataSource
idService: IdService
invitationStatusChangesService: InvitationStatusChangesService
jwtConfig: JwtConfigType
loggerFactory: WinstonLoggerFactory

Accessors

  • get repository(): Repository<U>

    Returns Repository<U>

  • get userToRoleRepository(): Repository<UR>

    Returns Repository<UR>

Methods

  • Apply UsersFilter to typeorm query builder

    Parameters

    Returns void

  • Apply UsersOrderBy to typeorm query builder

    Parameters

    Returns void

  • Change user password if old password is correct

    Returns Promise<boolean>

    if ether old password or new password is not provided

    if old password is incorrect

    if new password is the same as old password

    if user with provided id is not found

  • Generate id for new User entity

    Returns string

    'hcu:xxxxx'
    
  • Generate id for new UserToRole entity

    Returns string

    'hcurol:xxxxx'
    
  • Get user with given id

    Parameters

    • id: string

    Returns Promise<MaybeNull<U>>

  • Get user with given email

    Parameters

    • email: string

    Returns Promise<MaybeNull<U>>

  • Get user with given email

    Parameters

    Returns Promise<U>

    NotFoundException if user not found

  • Get user with given options or throw an error

    Parameters

    Returns Promise<U>

    • user entity

    NotFoundException if user not found

    BadRequestException if options are empty

  • Check if user with given id exists

    Parameters

    • id: string

    Returns Promise<boolean>

  • Check if user with given jwt access token exists

    Parameters

    Returns Promise<boolean>

  • Check if user with given email is unique

    Parameters

    Returns Promise<boolean>

  • Returns void

  • Parameters

    • userId: string

    Returns Promise<void>