Options
All
  • Public
  • Public/Protected
  • All
Menu
description

The main service to handle documents in the accounts collection.

since

v0.1.0

Hierarchy

  • AccountsService

Index

Constructors

Methods

  • This method executes a count query using the {@link model} argument.

    Caution: Count queries require a considerable amount of RAM to execute. It is preferred to use pro-active statistics with collections that contain one document with a counter.

    Parameters

    Returns Promise<number>

    The number of matching accounts.

  • This method updates exactly one document in a collection.

    async

    Parameters

    • query: AccountQuery

      The query configuration with sort, order, pageNumber, pageSize.

    • data: AccountModel

      The fields or data that has to be updated (will be added to $set: {}).

    • ops: Record<string, any> = {}

      The operations that must be run additionally (e.g. $inc: {}) (optional).

    Returns Promise<AccountDocument>

    The updated accounts document.

  • Method to query the existence of a document in the accounts collection.

    This executes a lean mongoose query such that the properties of the returned document are reduced to only the "_id" field.

    Parameters

    • query: AccountQuery

      The query configuration with sort, order, pageNumber, pageSize.

    Returns Promise<boolean>

    Whether a document exists which validates the passed query.

  • This method creates an accounts document for the authentication process. It is used internally to make sure an account always exists after an authentication challenge was successfully validated on-chain.

    Note that this method must be used only when the authentication payload has been validated and created, i.e. in AuthService.validateChallenge.

    access

    public

    async

    Parameters

    Returns Promise<AccountDocument>

    The corresponding accounts document.

  • updateBatch(accountDocuments: AccountModel[]): Promise<number>
  • createAddress(publicKeyOrAddress: string): Address
  • This helper method serves as a parser for account public keys and addresses.

    This static method can be used for any inputs that require to identify a participant [account]. Accounts can always be referred to by their public key as it can be used to generate the resulting identifier (address).

    Parameters

    • publicKeyOrAddress: string

      Must contain one of an account public key or an account address.

    Returns Address

    A parsed dHealth Account Address

  • getRandomReferralCode(): string

Generated using TypeDoc