Skip to content

@sourceloop/authentication-service / Exports / UserRepository

Class: UserRepository

Hierarchy

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new UserRepository(dataSource, getUserCredsRepository, getOtpRepository, tenantRepositoryGetter, userTenantRepositoryGetter, logger, passwordDecryptionFn, user)

Parameters

Name Type
dataSource DataSource
getUserCredsRepository Getter<UserCredentialsRepository>
getOtpRepository Getter<OtpRepository>
tenantRepositoryGetter Getter<TenantRepository>
userTenantRepositoryGetter Getter<UserTenantRepository>
logger ILogger
passwordDecryptionFn PasswordDecryptionFn
user typeof Entity & { prototype: User<DataObject<Model>> }

Overrides

DefaultSoftCrudRepository< User, typeof User.prototype.id, UserRelations \>.constructor

Defined in

services/authentication-service/src/repositories/user.repository.ts:58

Properties

credentials

Readonly credentials: HasOneRepositoryFactory<UserCredentials, undefined | string>

Defined in

services/authentication-service/src/repositories/user.repository.ts:47


getOtpRepository

getOtpRepository: Getter<OtpRepository>

Defined in

services/authentication-service/src/repositories/user.repository.ts:64


logger

Private Readonly logger: ILogger

Defined in

services/authentication-service/src/repositories/user.repository.ts:69


passwordDecryptionFn

Private Readonly passwordDecryptionFn: PasswordDecryptionFn

Defined in

services/authentication-service/src/repositories/user.repository.ts:71


tenant

Readonly tenant: BelongsToAccessor<Tenant, undefined | string>

Defined in

services/authentication-service/src/repositories/user.repository.ts:51


tenantRepositoryGetter

Protected tenantRepositoryGetter: Getter<TenantRepository>

Defined in

services/authentication-service/src/repositories/user.repository.ts:66


user

Private Readonly user: typeof Entity & { prototype: User<DataObject<Model>> }

Defined in

services/authentication-service/src/repositories/user.repository.ts:73


userTenantRepositoryGetter

Protected userTenantRepositoryGetter: Getter<UserTenantRepository>

Defined in

services/authentication-service/src/repositories/user.repository.ts:68


userTenants

Readonly userTenants: HasManyRepositoryFactory<UserTenant, undefined | string>

Defined in

services/authentication-service/src/repositories/user.repository.ts:53

Methods

changePassword

changePassword(username, newPassword, oldPassword?): Promise<User<DataObject<Model>>>

Parameters

Name Type
username string
newPassword string
oldPassword? string

Returns

Promise<User<DataObject<Model>>>

Defined in

services/authentication-service/src/repositories/user.repository.ts:184


create

create(entity, options?): Promise<User<DataObject<Model>>>

Parameters

Name Type
entity DataObject<User<DataObject<Model>>>
options? AnyObject

Returns

Promise<User<DataObject<Model>>>

Overrides

DefaultSoftCrudRepository.create

Defined in

services/authentication-service/src/repositories/user.repository.ts:103


createWithoutPassword

createWithoutPassword(entity, options?): Promise<User<DataObject<Model>>>

Parameters

Name Type
entity DataObject<User<DataObject<Model>>>
options? AnyObject

Returns

Promise<User<DataObject<Model>>>

Defined in

services/authentication-service/src/repositories/user.repository.ts:122


decryptPassword

decryptPassword(password): Promise<string>

Parameters

Name Type
password string

Returns

Promise<string>

Defined in

services/authentication-service/src/repositories/user.repository.ts:152


firstTimeUser

firstTimeUser(userId): Promise<boolean>

Parameters

Name Type
userId string

Returns

Promise<boolean>

Defined in

services/authentication-service/src/repositories/user.repository.ts:232


updateLastLogin

updateLastLogin(userId): Promise<void>

Parameters

Name Type
userId string

Returns

Promise<void>

Defined in

services/authentication-service/src/repositories/user.repository.ts:220


updatePassword

updatePassword(username, password, newPassword): Promise<User<DataObject<Model>>>

Parameters

Name Type
username string
password string
newPassword string

Returns

Promise<User<DataObject<Model>>>

Defined in

services/authentication-service/src/repositories/user.repository.ts:156


verifyPassword

verifyPassword(username, password): Promise<User<DataObject<Model>>>

Parameters

Name Type
username string
password string

Returns

Promise<User<DataObject<Model>>>

Defined in

services/authentication-service/src/repositories/user.repository.ts:129