Referrals

Referrals

new Referrals(db, collectionNameopt, referralLevelsopt)

Referral system class constructor
Source:
Parameters:
Name Type Attributes Default Description
db MongoClient MongoDB Driver connection object
collectionName string <optional>
referrals Referral collection name
referralLevels number <optional>
3 Count of levels

Methods

(async) createReferral(_id, payloadopt, parentopt, optionsopt) → {Promise}

Creating new referral with or without parent
Source:
Parameters:
Name Type Attributes Description
_id string | ObjectId Referral identifier
payload string <optional>
Some payload
parent string <optional>
Parent referral identifier
options object <optional>
Mongodb driver options for all requests (for example for transaction session)
Returns:
Type:
Promise

getReferrals(_id, optionsopt) → {Promise}

Getting referral data
Source:
Parameters:
Name Type Attributes Description
_id string | ObjectId Referral identifier
options object <optional>
Mongodb driver options for all requests (for example for transaction session)
Returns:
Type:
Promise

(async) removeReferral(_id, optionsopt) → {Promise}

Removing referral
Source:
Parameters:
Name Type Attributes Description
_id string | ObjectId Referral identifier
options object <optional>
Mongodb driver options for all requests (for example for transaction session)
Returns:
Type:
Promise

(async) updateReferralPayload(_id, payload, optionsopt) → {Promise}

Updating referral payload
Source:
Parameters:
Name Type Attributes Description
_id string | ObjectId Referral identifier
payload string Some payload (optional)
options object <optional>
Mongodb driver options for all requests (for example for transaction session)
Returns:
Type:
Promise