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

This class defines the exact fields that are stored in the corresponding MongoDB documents. It should be used whenever database documents are being handled or read for the activities collection.

Note that this class uses the generic Transferable trait to enable a toDTO() method on the model.

todo

Timestamp fields should be numbers to avoid timezone issues.

since

v0.3.2

Hierarchy

Index

Constructors

Properties

activityAssets?: ObjectLiteral[]

This is the activity mosaics as defined by dHealth Network. It contains an array of ObjectLiteral objects that consist of both a mosaicId and amount field.

This field contains the actual tokens that have been paid out to the end-user for this activity. It can hold only a single mosaic or up to 10 different mosaics that were sent to the end- user for completing this activity.

This field is optional, indexed and defaults to an empty array.

example

[{ "mosaicId": "39E0C49FA322A459", amount: 1 }]

access

public

readonly
var

{string}

activityData?: ActivityData

This is the activity data as processed from the data provider. It contains an object that consists of the activity data.

This object may represent [some] parts of an end-users Patient Health Record, as such it is important that this data is not accessible to unauthorized users.

This field is optional, not indexed and defaults to null.

example

{ "sport": "Run", calories: 1000 }

access

public

readonly
var

{string}

address: string

The account's address. An address typically refers to a human-readable series of 39 characters, starting either with a T, for TESTNET addresses, or with a N, for MAINNET addresses.

This field is required and indexed.

access

public

readonly
var

{string}

collectionName: string = "activities"

This field contains the mongo collection name for entries that are stored using ActivityDocument or the model ActivityModel.

Note that this field is not part of document properties and used only internally to perform queries that refer to an individual collection name, e.g. $unionWith.

access

public

var

{string}

createdAt?: Date

The document's creation timestamp. This field does not represent an activity's actual date of creation but rather the date of creation of the cached database entry.

For details about an activity's starting time, please refer to the ActivityDataSchema model instead.

access

public

readonly
var

{Date}

dateSlug: string

The activity's date slug consists of a YYYYMMDD formatted date and is used to prefix individual activity slugs.

This field is required and indexed.

access

public

readonly
var

{string}

distance: number

This field represents distance user completed during an activity.

This field is required and not indexed.

example

"swim"

access

public

var

{string}

elapsedTime: number

This property represents time that user spent on completing activity.

This field is required and not indexed.

example

"swim"

access

public

var

{string}

elevationGain: number

This property represents an elevation gain

This field is required and not indexed.

example

"swim"

access

public

var

{string}

payoutState?: PayoutState

This property is a flag that determines whether the activity payout has been executed. An activity is considered to be completed only after the payout has been confirmed on dHealth Network.

Possible values for this field in the database are of type number and listed in PayoutState. Initially, the value will always be 0 as this corresponds to "not-started".

This field is optional, indexed and defaults to 0.

example

0

access

public

readonly
var

{PayoutState}

processingState?: ProcessingState

This property is a flag that determines whether the activity has been processed by the processor before. An activity is considered to be fully processed only after the full details (activity data) has been downloaded from the data provider.

Possible values for this field in the database are of type number and listed in ProcessingState. Initially, the value will always be 0 as this corresponds to "not-processed".

This field is optional, indexed and defaults to 0.

example

0

access

public

readonly
var

{ProcessingState}

provider: string

The OAuth provider name. This is usually the name of the platform of which an account has completed an activity.

This field is required and not indexed.

access

public

readonly
var

{string}

remoteIdentifier: string

The activity identifier is a remote (external) identifier that is generated by the data provider and shared to uniquely identify the activity on the side of the data provider.

This field is required and indexed and must hold a unique value.

access

public

readonly
var

{string}

slug: string

The activity slug is composed of the date of the activity, the index of it on a daily basis, the activity identifier and the athlete identifier.

This field is required and indexed and must hold a unique value.

access

public

readonly
var

{string}

sport: string

Activity type field. Gets populated once user completes an activity.

This field is required and not indexed.

example

"swim"

access

public

var

{string}

updatedAt?: Date

The document's update timestamp. This field does not reflect the date of update of an integration but rather the date of update of the cached database entry.

access

public

readonly
var

{Date}

Accessors

  • get toQuery(): Record<string, unknown>
  • This method implements a specialized query format to query items individually, as documents, in the collection: account_integrations.

    access

    public

    Returns Record<string, unknown>

    The individual document data that is used in a query.

Methods

Generated using TypeDoc