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, passwordHashingFn, passwordVerifyFn, user)

Parameters

Name Type
dataSource DataSource
getUserCredsRepository Getter<UserCredentialsRepository>
getOtpRepository Getter<OtpRepository>
tenantRepositoryGetter Getter<TenantRepository>
userTenantRepositoryGetter Getter<UserTenantRepository>
logger ILogger
passwordDecryptionFn PasswordDecryptionFn
passwordHashingFn PasswordHashingFn
passwordVerifyFn PasswordVerifyFn
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:60

Properties

credentials

Readonly credentials: HasOneRepositoryFactory<UserCredentials, undefined | string>

Defined in

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


getOtpRepository

getOtpRepository: Getter<OtpRepository>

Defined in

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


logger

Private Readonly logger: ILogger

Defined in

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


passwordDecryptionFn

Private Readonly passwordDecryptionFn: PasswordDecryptionFn

Defined in

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


passwordHashingFn

Private Readonly passwordHashingFn: PasswordHashingFn

Defined in

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


passwordVerifyFn

Private Readonly passwordVerifyFn: PasswordVerifyFn

Defined in

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


tenant

Readonly tenant: BelongsToAccessor<Tenant, undefined | string>

Defined in

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


tenantRepositoryGetter

Protected tenantRepositoryGetter: Getter<TenantRepository>

Defined in

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


user

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

Defined in

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


userTenantRepositoryGetter

Protected userTenantRepositoryGetter: Getter<UserTenantRepository>

Defined in

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


userTenants

Readonly userTenants: HasManyRepositoryFactory<UserTenant, undefined | string>

Defined in

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

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:189


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:109


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:127


decryptPassword

decryptPassword(password): Promise<string>

Parameters

Name Type
password string

Returns

Promise<string>

Defined in

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


firstTimeUser

firstTimeUser(userId): Promise<boolean>

Parameters

Name Type
userId string

Returns

Promise<boolean>

Defined in

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


updateLastLogin

updateLastLogin(userId): Promise<void>

Parameters

Name Type
userId string

Returns

Promise<void>

Defined in

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


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:161


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:134