Skip to content

Shared Database models between platform microservices.

Notifications You must be signed in to change notification settings

pillarwallet/common-models

Repository files navigation

common-model

Common-model is a utility that aims to be a shared package to facilitate data manipulation across different APIs.

Updating this README.md

Run npm run generateReadme to parse the code for JSDoc comment blocks and recreate this README.md file.

Install

Run npm i @pillarwallet/common-models Then npm i mongoose@5.x -E

Examples

Instantiate a model with options:

const options =
{
  username: 'myUserName',
};

const { platform } = require('@pillarwallet/common-models');
// Create user model
const user = new platform.User(options);

API

Objects

AccessTokenBackup : object

AccessTokenBackup model maps to a MongoDB collection and defines the shape of the document.

AccessTokenBlacklist : object

AccessTokenBlacklist model maps to a MongoDB collection and defines the shape of the document.

Asset : object

Asset model maps to a MongoDB collection and defines the shape of the document.

Badge : object

Badge model maps to a MongoDB collection and defines the shape of the document.

BadgeAward : object

BadgeAward model maps to a MongoDB collection and defines the shape of the document.

Blacklist : object

Blacklist model maps to a MongoDB collection and defines the shape of the document.

BlacklistedUsernames : object

BlacklistedUsernames model maps to a MongoDB collection and defines the shape of the document.

BtcDeposit : object

BtcDeposit model maps to a MongoDB collection and defines the shape of the document.

Connection : object

Connection model maps to a MongoDB collection and defines the shape of the document.

IpfsStorage : object

IpfsStorage model maps to a MongoDB collection and defines the shape of the document.

Notification : object

Notification model maps to a MongoDB collection and defines the shape of the document.

NotificationPreferences : object

NotificationPreferences model maps to a MongoDB collection and defines the shape of the document.

NotificationType : object

NotificationType model maps to a MongoDB collection and defines the shape of the document.

ReferralCampaign : object

ReferralCampaign model maps to a MongoDB collection and defines the shape of the document.

ReferralDevice : object

ReferralDevice model maps to a MongoDB collection and defines the shape of the document.

ReferralInvitation : object

ReferralInvitation model maps to a MongoDB collection and defines the shape of the document.

ReferralTransaction : object

ReferralTransaction model maps to a MongoDB collection and defines the shape of the document.

Register : object

Register model

Story : object

Story model maps to a MongoDB collection and defines the shape of the document.

StoryPage : object

StoryPage model maps to a MongoDB collection and defines the shape of the document.

User : object

User model maps to a MongoDB collection and defines the shape of the document.

UserFeatureFlags : object

UserFeatureFlags model maps to a MongoDB collection and defines the shape of the document.

Wallet : object

Wallet model maps to a MongoDB collection and defines the shape of the document.

AccessTokenBackup : object

AccessTokenBackup model maps to a MongoDB collection and defines the shape of the document.

Kind: global namespace

Param
schema

AccessTokenBackup~userId : String

The user identifier.

Kind: inner property of AccessTokenBackup
Required:

AccessTokenBackup~contactId : String

The contact identifier.

Kind: inner property of AccessTokenBackup
Required:

AccessTokenBackup~accessKey : String

Unique identifier for each connection.

Kind: inner property of AccessTokenBackup
Required:

AccessTokenBlacklist : object

AccessTokenBlacklist model maps to a MongoDB collection and defines the shape of the document.

Kind: global namespace

Param
schema

AccessTokenBlacklist~accessToken : String

A user's valid access token.

Kind: inner property of AccessTokenBlacklist
Required:

Asset : object

Asset model maps to a MongoDB collection and defines the shape of the document.

Kind: global namespace

Param
schema

Asset~address : String

The smart contract address.

Kind: inner property of Asset
Unique:
Required:

Asset~decimals : Number

Refers to how divisible a token can be.

Kind: inner property of Asset
Required:

Asset~description : String

Simple description of one Token.

Kind: inner property of Asset

Asset~name : String

Name by which the token contract should be known.

Kind: inner property of Asset
Required:
Unique:

Asset~symbol : String

Symbol by which the token contract should be known, it is broadly equivalent to a stock ticker.

Kind: inner property of Asset
Required:
Unique:

Asset~wallpaperUrl : String

The token's predefined background image.

Kind: inner property of Asset

Asset~iconUrl : String

The token's predefined icon image.

Kind: inner property of Asset

Asset~iconMonoUrl : String

The token's predefined mono icon image.

Kind: inner property of Asset

Asset~patternUrl : String

The token's predefined icon image (bigger).

Kind: inner property of Asset

Asset~email : String

The token's email.

Kind: inner property of Asset

Asset~telegram

Deprecated

Kind: inner property of Asset

Asset~twitter

Deprecated

Kind: inner property of Asset

Asset~socialMedia : Array

The token's social media.

Kind: inner property of Asset

Asset~website : String

The token's website.

Kind: inner property of Asset

Asset~whitepaper : String

The token's whitepaper.

Kind: inner property of Asset

Asset~isDefault : Boolean

One flag to check if the Token is default on the wallet.

Kind: inner property of Asset

Asset~isPreferred : Boolean

A flag to indicate preferred tokens within the system.

Kind: inner property of Asset

Asset~totalSupply : String

Kind: inner property of Asset

Asset~icos : Array

Ico details of one Token.

Kind: inner property of Asset

Asset~isSynthetixAsset : Boolean

A boolean flag to indicate whether this is a Synthetix asset

Kind: inner property of Asset

Badge : object

Badge model maps to a MongoDB collection and defines the shape of the document.

Kind: global namespace

Param
schema

Badge~name : String

Name by which the badge should be known.

Kind: inner property of Badge
Required:

Badge~type : String

Badge type by which backend could find particular badge.

Kind: inner property of Badge
Required:
Unique:

Badge~imageUrl : String

Image url of the badge.

Kind: inner property of Badge

Badge~subtitle : String

Optional subtitle of the badge.

Kind: inner property of Badge

Badge~description : String

Simple description of one badge.

Kind: inner property of Badge

Badge~selfAward : Boolean

A flag to indicate if the badge could be self awarded.

Kind: inner property of Badge

BadgeAward : object

BadgeAward model maps to a MongoDB collection and defines the shape of the document.

Kind: global namespace

Param
schema

BadgeAward~badge : String

Badge id.

Kind: inner property of BadgeAward
Required:

BadgeAward~badgeType : String

Badge type.

Kind: inner property of BadgeAward
Required:

BadgeAward~userId : String

User Id.

Kind: inner property of BadgeAward
Required:

BadgeAward~walletId : String

Wallet Id.

Kind: inner property of BadgeAward
Required:

Blacklist : object

Blacklist model maps to a MongoDB collection and defines the shape of the document.

Kind: global namespace

Param
schema

Blacklist~userId : String

The user identifier.

Kind: inner property of Blacklist
Required:

Blacklist~targetUserId : String

The blacklisted user identifier.

Kind: inner property of Blacklist
Required:

BlacklistedUsernames : object

BlacklistedUsernames model maps to a MongoDB collection and defines the shape of the document.

Kind: global namespace

Param
schema

BlacklistedUsernames~username : String

The blacklisted username.

Kind: inner property of BlacklistedUsernames
Unique:
Required:

BtcDeposit : object

BtcDeposit model maps to a MongoDB collection and defines the shape of the document.

Kind: global namespace

Param
schema

BtcDeposit~status : String

The status of the deposit [awaiting, received, submitted].

Kind: inner property of BtcDeposit
Required:

BtcDeposit~nonce : String

The nonce of the deposit.

Kind: inner property of BtcDeposit
Required:

BtcDeposit~txHash : String

Hash of the transaction.

Kind: inner property of BtcDeposit
Required:

BtcDeposit~ethereumTxHash : String

Hash of the ethereum transaction.

Kind: inner property of BtcDeposit
Required:

BtcDeposit~method : String

The method [mint, burn].

Kind: inner property of BtcDeposit
Required:

BtcDeposit~amount : Number

The transaction amount.

Kind: inner property of BtcDeposit

BtcDeposit~exchangeRate : Number

The minimum exchange rate.

Kind: inner property of BtcDeposit

BtcDeposit~slippage : Number

The maximum slippage.

Kind: inner property of BtcDeposit

BtcDeposit~sender : String

The sender address.

Kind: inner property of BtcDeposit
Required:

BtcDeposit~destination : String

The destination address.

Kind: inner property of BtcDeposit
Required:

BtcDeposit~gateway : String

The gateway address.

Kind: inner property of BtcDeposit
Required:

BtcDeposit~nHash : String

The deposit nhash.

Kind: inner property of BtcDeposit
Required:

BtcDeposit~signature : String

The deposit signature.

Kind: inner property of BtcDeposit
Required:

BtcDeposit~vOut : Number

The deposit vOut.

Kind: inner property of BtcDeposit
Required:

BtcDeposit~confirmations : Number

The number of confirmations.

Kind: inner property of BtcDeposit
Required:

Connection : object

Connection model maps to a MongoDB collection and defines the shape of the document.

Kind: global namespace

Param
schema

Connection~userId : String

The user identifier.

Kind: inner property of Connection
Required:

Connection~accessKey : String

Unique identifier for each connection.

Kind: inner property of Connection
Required:

Connection~status : String

The status of each connection.

Kind: inner property of Connection
Required:

Connection~sourceIdentityKey : String

The sourceIdentityKey of each connection.

Kind: inner property of Connection
Unique:

Connection~targetIdentityKey : String

The targetIdentityKey of each connection.

Kind: inner property of Connection
Unique:

Connection~targetUserId : String

The target user identifier.

Kind: inner property of Connection

Connection~direction : String

The direction of the connection.

Kind: inner property of Connection

Connection~version : String

Connections supoort version.

Kind: inner property of Connection

IpfsStorage : object

IpfsStorage model maps to a MongoDB collection and defines the shape of the document.

Kind: global namespace

Param
schema

IpfsStorage~walletId : String

The id of the wallet.

Kind: inner property of IpfsStorage
Required:

IpfsStorage~storageId : String

The id of the IPFS storage.

Kind: inner property of IpfsStorage
Required:
Unique:

IpfsStorage~secretKey : String

Secret key for the IPFS storage.

Kind: inner property of IpfsStorage
Required:
Unique:

Notification : object

Notification model maps to a MongoDB collection and defines the shape of the document.

Kind: global namespace

Param
schema

Notification~type : String

The type of one notification.

Kind: inner property of Notification
Required:

Notification~meta : Object

Additional important information about one notification.

Kind: inner property of Notification
Required:

Notification~payload : Object

The content of one notification.

Kind: inner property of Notification
Required:

NotificationPreferences : object

NotificationPreferences model maps to a MongoDB collection and defines the shape of the document.

Kind: global namespace

Param
schema

NotificationPreferences~userId : String

The user identifier.

Kind: inner property of NotificationPreferences
Required:
Unique:

NotificationPreferences~newOffer : Boolean

One flag for newOffer notification.

Kind: inner property of NotificationPreferences
Required:

NotificationPreferences~newReceipt : Boolean

One flag for newReceipt notification.

Kind: inner property of NotificationPreferences
Required:

NotificationPreferences~paymentConfirmation : Boolean

One flag for paymentConfirmation notification.

Kind: inner property of NotificationPreferences
Required:

NotificationPreferences~paymentStatusUpdate : Boolean

One flag for paymentStatusUpdate notification.

Kind: inner property of NotificationPreferences
Required:

NotificationPreferences~profileUpdate : Boolean

One flag for profileUpdate notification.

Kind: inner property of NotificationPreferences
Required:

NotificationPreferences~fundsDeposit : Boolean

One flag for fundsDeposit notification.

Kind: inner property of NotificationPreferences
Required:

NotificationPreferences~transactionEvent : Boolean

One flag for transactionEvent notification.

Kind: inner property of NotificationPreferences
Required:

NotificationType : object

NotificationType model maps to a MongoDB collection and defines the shape of the document.

Kind: global namespace

Param
schema

NotificationType~type : String

The type of one notification.

Kind: inner property of NotificationType
Required:
Unique:

NotificationType~name : String

The name of one notification.

Kind: inner property of NotificationType
Required:

NotificationType~actions : Object

Actions related with one notification.

Kind: inner property of NotificationType
Required:

ReferralCampaign : object

ReferralCampaign model maps to a MongoDB collection and defines the shape of the document.

Kind: global namespace

Param
schema

ReferralCampaign~name : String

Name of the campaign.

Kind: inner property of ReferralCampaign
Required:
Unique:

ReferralCampaign~token : String

Default token issued for the campaign.

Kind: inner property of ReferralCampaign
Required:

ReferralCampaign~contractAddress : String

Contract address of the default token.

Kind: inner property of ReferralCampaign
Required:

ReferralCampaign~wallet : Object

The reward wallet.

Kind: inner property of ReferralCampaign
Required:

ReferralCampaign~logoUrl : String

Logo URL to S3.

Kind: inner property of ReferralCampaign

ReferralCampaign~badges : Boolean

Flag indicating if the campaign should issue badges.

Kind: inner property of ReferralCampaign

ReferralCampaign~isActive : Boolean

Flag indicating if the campaign is active.

Kind: inner property of ReferralCampaign

ReferralCampaign~relatedCampaigns : [ 'Array' ].<String>

An array of related campaigns.

Kind: inner property of ReferralCampaign

ReferralDevice : object

ReferralDevice model maps to a MongoDB collection and defines the shape of the document.

Kind: global namespace

Param
schema

ReferralDevice~deviceInfo : String

Device info stored as checksum.

Kind: inner property of ReferralDevice
Unique:
Required:

ReferralDevice~deviceOs : String

Device OS.

Kind: inner property of ReferralDevice
Required:

ReferralDevice~firstInstall : String

Flag for first install.

Kind: inner property of ReferralDevice
Required:

ReferralInvitation : object

ReferralInvitation model maps to a MongoDB collection and defines the shape of the document.

Kind: global namespace

Param
schema

ReferralInvitation~amount : Number

Default amount to reward.

Kind: inner property of ReferralInvitation

ReferralInvitation~userId : String

The user identifier of the inviter.

Kind: inner property of ReferralInvitation
Required:

ReferralInvitation~email : String

Email of the invited person.

Kind: inner property of ReferralInvitation

ReferralInvitation~phone : String

Phone of the invited person.

Kind: inner property of ReferralInvitation

ReferralInvitation~claimed : Boolean

Flag indicating if the user claimed the reward.

Kind: inner property of ReferralInvitation

ReferralInvitation~invitedUserId : String

The user identifier of the invited user.

Kind: inner property of ReferralInvitation

ReferralInvitation~token : String

Token generated by Platform-Core API, to validate Branch.io webhooks.

Kind: inner property of ReferralInvitation
Required:

ReferralInvitation~partner : Boolean

Flag indicating if it is a partner campaign.

Kind: inner property of ReferralInvitation

ReferralInvitation~campaign : String

The campaign identifier.

Kind: inner property of ReferralInvitation

ReferralInvitation~amount : Number

The amount to reward.

Kind: inner property of ReferralInvitation

ReferralInvitation~notified : Boolean

Flag indicating if the user has been notified when the campaign has been terminated.

Kind: inner property of ReferralInvitation

ReferralTransaction : object

ReferralTransaction model maps to a MongoDB collection and defines the shape of the document.

Kind: global namespace

Param
schema

ReferralTransaction~name : String

The status of the transaction [confirmed, failed].

Kind: inner property of ReferralTransaction
Required:

ReferralTransaction~ethAddress : String

Address of the user to be rewarded.

Kind: inner property of ReferralTransaction
Required:

ReferralTransaction~txHash : String

Hash of the transaction.

Kind: inner property of ReferralTransaction
Required:

ReferralTransaction~amount : Number

The amount of PLR for the reward.

Kind: inner property of ReferralTransaction
Required:

ReferralTransaction~asset : String

Asset symbol.

Kind: inner property of ReferralTransaction

Register : object

Register model

Kind: global namespace

Register~authorizationCode : String

Authorisation code generated by platform-authentication

Kind: inner property of Register

Register~nonce : String

A one time code for a request between the wallet and platform-core

Kind: inner property of Register
Required:

Register~nonceExpiry : String

The expiry of the nonce

Kind: inner property of Register
Required:

Register~publicKey : String

The public key of a wallet

Kind: inner property of Register
Required:

Register~uuid : String

A random unique identifier used for the registration process

Kind: inner property of Register
Required:

Register~walletId : String

The ID of a wallet that's created as part of the registration flow

Kind: inner property of Register

Story : object

Story model maps to a MongoDB collection and defines the shape of the document.

Kind: global namespace

Param
schema

Story~shortTitle : String

Short title of the story.

Kind: inner property of Story
Required:

Story~imageUrl : String

The story's preview image.

Kind: inner property of Story

Story~imageMonoUrl : String

The story's preview mono image.

Kind: inner property of Story

Story~active : Boolean

Flag to enable/disable the story preview.

Kind: inner property of Story

Story~topic : String

Topic for the story page.

Kind: inner property of Story
Required:

Story~title : String

Title of the story page.

Kind: inner property of Story
Required:

Story~likes : Number

Counter for the likes of a story page.

Kind: inner property of Story

StoryPage : object

StoryPage model maps to a MongoDB collection and defines the shape of the document.

Kind: global namespace

Param
schema

StoryPage~storyId : String

ID of the story to which the page belongs.

Kind: inner property of StoryPage

StoryPage~pageNumber : Number

Number of the page in a story.

Kind: inner property of StoryPage

StoryPage~body : String

Body text of the story page.

Kind: inner property of StoryPage

StoryPage~imageUrl : String

The story's uploaded image.

Kind: inner property of StoryPage

StoryPage~imageMonoUrl : String

The story's uploaded mono image.

Kind: inner property of StoryPage

StoryPage~layoutType : String

Predefined layout type for the story page.

Kind: inner property of StoryPage
Required:

StoryPage~backgroundColor : String

Background color value.

Kind: inner property of StoryPage

StoryPage~textContrast : String

Text Contrast.

Kind: inner property of StoryPage

User : object

User model maps to a MongoDB collection and defines the shape of the document.

Kind: global namespace

Param
schema

User~username : String

The username.

Kind: inner property of User
Required:
Unique:

User~registrationId : String

The user's registration Id.

Kind: inner property of User

User~firstName : String

The user's first name.

Kind: inner property of User

User~lastName : String

The user's last name.

Kind: inner property of User

User~email : String

The user's email.

Kind: inner property of User

User~isEmailVerified : Boolean

One flag to check user's email.

Kind: inner property of User

User~emailOneTimePassword : String

The user's email one time password.

Kind: inner property of User

User~phone : String

The user's phone.

Kind: inner property of User

User~isPhoneVerified : Boolean

One flag to check user's phone.

Kind: inner property of User

User~phoneOneTimePassword : String

The user's phone one time password.

Kind: inner property of User

User~country : String

The user's country.

Kind: inner property of User

User~state : String

The user's state.

Kind: inner property of User

User~city : String

The user's city.

Kind: inner property of User

User~userSearchable : Boolean

One flag to check if user is searchable.

Kind: inner property of User

User~tagline : String

The user's tagline.

Kind: inner property of User

User~taglineStatus : Boolean

One flag to check if user's tagline is displayable.

Kind: inner property of User

User~profileImage : String

The user's profileImage.

Kind: inner property of User

User~icoService : Object

Information related to the user's account with a service provider for ICOs.

Kind: inner property of User

User~status : String

The user status in the system.

Kind: inner property of User

User~secretId : String

The user secretId.

Kind: inner property of User
Required:

User~betaProgramParticipant : Boolean

One flag to check if user is beta program participant.

Kind: inner property of User

User~lastSeen : Date

A timestamp with user last activity

Kind: inner property of User

UserFeatureFlags : object

UserFeatureFlags model maps to a MongoDB collection and defines the shape of the document.

Kind: global namespace

Param
schema

UserFeatureFlags~userId : String

The user identifier.

Kind: inner property of UserFeatureFlags
Required:
Unique:

UserFeatureFlags~smartWallet : Boolean

One flag for Smart Wallet support.

Kind: inner property of UserFeatureFlags

UserFeatureFlags~bitcoin : Boolean

One flag for Bitcoin support.

Kind: inner property of UserFeatureFlags

Wallet : object

Wallet model maps to a MongoDB collection and defines the shape of the document.

Kind: global namespace

Param
schema

Wallet~publicKey : String

The public Key of one user.

Kind: inner property of Wallet
Required:

Wallet~userId : String

The user identifier.

Kind: inner property of Wallet
Required:

Wallet~ethAddress : String

The ethereum address of one user.

Kind: inner property of Wallet
Required:
Unique:

Wallet~fcmToken : String

The fcm identifier of one user.

Kind: inner property of Wallet

Wallet~signalRegistrationId : String

The user's signal identifier.

Kind: inner property of Wallet

Wallet~bcxRegistered : Boolean

One flag to check BCX registration.

Kind: inner property of Wallet

Wallet~blocknativeRegistered : Boolean

One flag to check Blocknative address registration.

Kind: inner property of Wallet

Wallet~type : String

The type of the wallet.

Kind: inner property of Wallet

Wallet~disabled : Boolean

A flag indicating if the wallet is disabled or not.

Kind: inner property of Wallet
Required:

Wallet~recovery : Boolean

A flag indicating if the wallet is recovery wallet or not.

Kind: inner property of Wallet
Required:

About

Shared Database models between platform microservices.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published