@leaddreamer/ESBusiness
Business Logic for the Events Services system, wrapped around FirebaseWrapper, to be shared between Back and Front End. This particular library only provides the business "logic" - not browser services.
Modules
- ESBusiness
-
Business Logic for the Event Services system, wrapped around FirebaseWrapper, to be shared between Back and Front End. This particular library only provides the business "logic" - not browser services.
- PricingLogic
-
A collection of Business logic and database functions. Sahred between ReactJS frontEnd and NodeJS BackEnd
- Commodities
-
Typedefs, constants, support functions and database operations related to Commodity Matrials users
- LineItems
-
Typedefs, constants, support functions and database operations related to LineItem Matrials users
- Payment
-
"Payment Descriptor" handling operations. These descriptors represent paymentMethods, each tied to an individual user. These do not particularly represent a paymentProvider - they are meant as an abstraction above a specific payment processor.
- People
-
Typedefs, constants, support functions and database operations related to individual users
- Product
-
Typedefs, constants, support functions and database operations related to Products
- Stages
-
Typedefs, constants, support functions and database operations related to product creation stages users
- Boilerplate
-
Shared constants and symbols
ESBusiness
Business Logic for the Event Services system, wrapped around FirebaseWrapper, to be shared between Back and Front End. This particular library only provides the business "logic" - not browser services.
-
ESBusiness
-
static
-
.databasePromise(firebase, config, thisLogger) ⇒
Promise.Firebase
-
.databasePromise(firebase, config, thisLogger) ⇒
-
inner
-
~FirebaseConfigObject :
object
-
~FirebaseConfigObject :
-
static
Promise.Firebase
ESBusiness.databasePromise(firebase, config, thisLogger) ⇒ all-in-one wrapper for a solid subset of CLIENT-SIDE Firebase functions, with a consistent interface. There is a parallel set for ADMIN-SIDE functions as well. Call/initialize with Firebase Configuration settings in an object as described below
Kind: static method of ESBusiness
Param | Type | Description |
---|---|---|
firebase | Firebase |
|
config | FirebaseConfigObject |
Firebase Admin object |
thisLogger | callback |
Example
//this specifically loads ALL the subsections, specifically for
//the Browser. See later (tbd) notes for NodeJS
import FirebaseWrapper from "@leaddreamer/firebase-wrapper";
FirebaseWrapper(config); //see below
export * from "@leaddreamer/firebase-wrapper";
object
ESBusiness~FirebaseConfigObject : only authDomain, databaseURL and storageBucket are present when called from a cloud environment
Kind: inner typedef of ESBusiness
Properties
Name | Type | Description |
---|---|---|
apiKey | string |
required api Key from Firebase Console, |
appId | string |
required app ID from Firebase Console |
projectId | string |
required Firebase projectID from Firebase console |
authDomain | string |
(optional) auth domain from Firebase Console |
databaseURL | string |
(optional) Firestore database URL from Firebase console |
storageBucket: | string |
(optional) URL of Firestore Storage Bucket |
messagingSenderId: | string |
(optional) ID for Messaing service from Firebase Console |
measurementId: | string |
(optional) Analytics/Measurement ID from Firebase Console |
mapsAPIKey | string |
(optional) App ID for Google Maps API, from Google |
PricingLogic
A collection of Business logic and database functions. Sahred between ReactJS frontEnd and NodeJS BackEnd
Commodities
Typedefs, constants, support functions and database operations related to Commodity Matrials users
-
Commodities
-
static
-
.createCommodity ⇒
Promise.Commodity
-
.deleteCommodity(commodity, person) ⇒
Promise.<void>
-
.deleteCommodityById(commodity, person) ⇒
Promise.<void>
-
.updateCommodityByID(commodity, person) ⇒
promise.Commodity
-
.updateCommodity(commodity, person) ⇒
promise.Commodity
-
.knownCommodity(Id, person) ⇒
Promise.boolean
-
.fetchCommodities(person) ⇒
Array.Commodity
-
.fetchCommoditiesPaginated(limit, person) ⇒
PaginatedFetch
-
.fetchCommodity(commodityId, person) ⇒
Promise.Commodity
-
.fetchCommodityName(commodityId, person) ⇒
Promise.string
-
.summarizeCommodity(commodity) ⇒
string
-
.createCommodity ⇒
-
inner
-
~CommodityDefault :
Commodity
-
~CommodityDefaultForm :
Commodity
-
~Commodity :
object
-
~PaginatedFetch :
object
-
~CommodityDefault :
-
static
Promise.Commodity
Commodities.createCommodity ⇒ Kind: static constant of Commodities
Param | Type | Description |
---|---|---|
commodity | Commodity |
minimal record of user account |
person | Person |
minimal record of person this commodity belongs to (if any) |
Promise.<void>
Commodities.deleteCommodity(commodity, person) ⇒ Kind: static method of Commodities
Param | Type | Description |
---|---|---|
commodity | CommodityDefault |
|
person | Person |
minimal record of person this commodity belongs to (if any) |
Promise.<void>
Commodities.deleteCommodityById(commodity, person) ⇒ Kind: static method of Commodities
Param | Type | Description |
---|---|---|
commodity | CommodityDefault |
minimal record of user account |
commodity.Id | string |
record Id of account |
person | Person |
minimal record of person this commodity belongs to (if any) |
promise.Commodity
Commodities.updateCommodityByID(commodity, person) ⇒ writes record back to database. Assumes only Id is valid
Kind: static method of Commodities
Returns: promise.Commodity
- a copy of the data written
Param | Type | Description |
---|---|---|
commodity | Commodity |
a partially-populated commodity record for updates |
person | Person |
minimal record of person this commodity belongs to (if any) |
promise.Commodity
Commodities.updateCommodity(commodity, person) ⇒ writes record back to database. Assumes only Id is valid
Kind: static method of Commodities
Returns: promise.Commodity
- a copy of the data written
Param | Type | Description |
---|---|---|
commodity | Commodity |
a partially-populated commodity record for updates |
person | Person |
minimal record of person this commodity belongs to (if any) |
Promise.boolean
Commodities.knownCommodity(Id, person) ⇒ Checks if this is a known Commodity Id
Kind: static method of Commodities
Returns: Promise.boolean
- true is this Id is in database
Param | Type | Description |
---|---|---|
Id | string |
Id value to check |
person | Person |
minimal record of person this commodity belongs to (if any) |
Array.Commodity
Commodities.fetchCommodities(person) ⇒ Fetches ALL Commodity records. Not very useful
Kind: static method of Commodities
Param | Type | Description |
---|---|---|
person | Person |
minimal record of person this commodity belongs to (if any) |
PaginatedFetch
Commodities.fetchCommoditiesPaginated(limit, person) ⇒ Fetchs an object to fetch pages of commodity data, ascending by name, "limit" at a time
Kind: static method of Commodities
Returns: PaginatedFetch
- object with pagination methods
Param | Type | Description |
---|---|---|
limit | number |
|
person | Person |
minimal record of person this commodity belongs to (if any) |
Promise.Commodity
Commodities.fetchCommodity(commodityId, person) ⇒ Fetches a single Commodity record by Id
Kind: static method of Commodities
Param | Type | Description |
---|---|---|
commodityId | string |
|
person | Person |
minimal record of person this commodity belongs to (if any) |
Promise.string
Commodities.fetchCommodityName(commodityId, person) ⇒ Fetches and returns the summarized name from a Commodity record
Kind: static method of Commodities
Returns: Promise.string
- the summarized name from the record
Param | Type | Description |
---|---|---|
commodityId | string |
|
person | Person |
minimal record of person this commodity belongs to (if any) |
string
Commodities.summarizeCommodity(commodity) ⇒ Returns a standardized formatted name string
Kind: static method of Commodities
Returns: string
- formatted name string
Param | Type |
---|---|
commodity | Commodity |
Commodity
Commodities~CommodityDefault : Kind: inner constant of Commodities
Default: {"Id":null,"refPath":null,"description":null,"unit":null,"rate":0,"HighValue":true,"image":null}
Read only: true
Commodity
Commodities~CommodityDefaultForm : Kind: inner constant of Commodities
Default: {"description":"text","unit":"lookup:units","rate":"number","HighValue":"boolean","image":"url"}
Read only: true
object
Commodities~Commodity : a record
Kind: inner typedef of Commodities
Properties
Name | Type | Description |
---|---|---|
Id | string |
Id of document (redundant for convenience) |
refPath | string |
if from database, full path to document |
description | string |
description, e.g. "Wire, Silver, Sterling, 20ga" |
unit | string |
usage/measurement unit (for unit conversion) |
rate | number |
the per unit cost of this commodity |
HighValue | boolean |
boolean flag to indicate "High Value" (lower markup) commodities |
image | url |
a reference image for the commodity |
object
Commodities~PaginatedFetch : An object to allow for paginating a table read from Firestore. REQUIRES a sorting choice
Kind: inner typedef of Commodities
Properties
Name | Type | Description |
---|---|---|
Query | Query |
that forms basis for the table read |
limit | number |
page size |
snapshot | QuerySnapshot |
last successful snapshot/page fetched |
status | enum |
status of pagination object |
PageForward | method |
pages the fetch forward |
PageBack | method |
pages the fetch backward |
LineItems
Typedefs, constants, support functions and database operations related to LineItem Matrials users
-
LineItems
-
static
-
.createLineItem ⇒
Promise.LineItem
-
.deleteLineItem(lineItem) ⇒
Promise.<void>
-
.deleteLineItemById(lineItem, minimal) ⇒
Promise.<void>
-
.updateLineItemByID(lineItem, product) ⇒
promise.LineItem
-
.updateLineItem(lineItem, product) ⇒
promise.LineItem
-
.knownLineItem(Id, product) ⇒
Promise.boolean
-
.fetchLineItems() ⇒
Array.LineItem
-
.fetchProductLineItems(product, stage) ⇒
Array.LineItem
-
.paginateProductLineItems(product, stage, limit) ⇒
PaginatedFetch
-
.fetchLineItem(lineItemId, product) ⇒
Promise.LineItem
-
.fetchLineItemName(lineItemId, product) ⇒
Promise.string
-
.summarizeLineItem(lineItem) ⇒
string
-
.createLineItem ⇒
-
inner
-
~LineItemDefault :
LineItem
-
~LineItemDefaultForm :
LineItem
-
~LineItem :
object
-
~PaginatedFetch :
object
-
~LineItemDefault :
-
static
Promise.LineItem
LineItems.createLineItem ⇒ Kind: static constant of LineItems
Param | Type | Description |
---|---|---|
lineItem | LineItem |
minimal record of user account |
product | Product |
minimal record of product this lineItem belongs to |
Promise.<void>
LineItems.deleteLineItem(lineItem) ⇒ Kind: static method of LineItems
Param | Type |
---|---|
lineItem | LineItemDefault |
Promise.<void>
LineItems.deleteLineItemById(lineItem, minimal) ⇒ Kind: static method of LineItems
Param | Type | Description |
---|---|---|
lineItem | LineItemDefault |
minimal record of lineItem in question |
lineItem.Id | string |
record Id of account |
minimal | Product |
record of product this lineItem belongs to |
promise.LineItem
LineItems.updateLineItemByID(lineItem, product) ⇒ writes record back to database. Assumes only Id is valid
Kind: static method of LineItems
Returns: promise.LineItem
- a copy of the data written
Param | Type | Description |
---|---|---|
lineItem | LineItem |
a minimal lineItem record for updates |
product | Product |
minimal record of product this lineItem belongs to |
promise.LineItem
LineItems.updateLineItem(lineItem, product) ⇒ writes record back to database. Assumes only Id is valid
Kind: static method of LineItems
Returns: promise.LineItem
- a copy of the data written
Param | Type | Description |
---|---|---|
lineItem | LineItem |
a partially-populated lineItem record for updates |
product | Product |
minimal record of product this lineItem belongs to |
Promise.boolean
LineItems.knownLineItem(Id, product) ⇒ Checks if this is a known LineItem Id
Kind: static method of LineItems
Returns: Promise.boolean
- true is this Id is in database
Param | Type | Description |
---|---|---|
Id | string |
Id value to check |
product | Product |
minimal record of product this lineItem belongs to |
Array.LineItem
LineItems.fetchLineItems() ⇒ Fetches ALL LineItem records. Not very useful
Kind: static method of LineItems
Array.LineItem
LineItems.fetchProductLineItems(product, stage) ⇒ Fetches ALL LineItem records for a specific product. Not very useful
Kind: static method of LineItems
Param | Type | Description |
---|---|---|
product | Product |
minimal record of product this lineItem belongs to |
stage | Stage |
optional stage selection, to get a subset of the line items |
PaginatedFetch
LineItems.paginateProductLineItems(product, stage, limit) ⇒ Fetchs an object to fetch pages of lineItem data, ascending by name, "limit" at a time
Kind: static method of LineItems
Returns: PaginatedFetch
- object with pagination methods
Param | Type | Description |
---|---|---|
product | Product |
|
stage | Stage |
optional stage selection, to get a subset of the line items |
limit | number |
Promise.LineItem
LineItems.fetchLineItem(lineItemId, product) ⇒ Fetches a single LineItem record by Id
Kind: static method of LineItems
Param | Type | Description |
---|---|---|
lineItemId | string |
|
product | Product |
minimal record of product this lineItem belongs to |
Promise.string
LineItems.fetchLineItemName(lineItemId, product) ⇒ Fetches and returns the summarized name from a LineItem record
Kind: static method of LineItems
Returns: Promise.string
- the summarized name from the record
Param | Type | Description |
---|---|---|
lineItemId | string |
|
product | Product |
minimal record of product this lineItem belongs to |
string
LineItems.summarizeLineItem(lineItem) ⇒ Returns a standardized formatted name string
Kind: static method of LineItems
Returns: string
- formatted name string
Param | Type |
---|---|
lineItem | LineItem |
LineItem
LineItems~LineItemDefault : Kind: inner constant of LineItems
Default: {"Id":null,"refPath":null,"stage":"fabrication","commodity":null,"description":null,"unit":null,"rate":0,"amount":0,"HighValue":true,"image":null}
Read only: true
LineItem
LineItems~LineItemDefaultForm : Kind: inner constant of LineItems
Default: {"product":"lookup","stage":"lookup","commodity":"lookupLink","description":"text","unit":"lookup:units","rate":"number","amount":"number","HighValue":"boolean","image":"url"}
Read only: true
object
LineItems~LineItem : a record
Kind: inner typedef of LineItems
Properties
Name | Type | Description |
---|---|---|
Id | string |
Id of document (redundant for convenience) |
refPath | string |
if from database, full path to document |
stage | string |
"fabrication", "wholesale", or other to be defined |
commodity |
null | string
|
Id of a commodity item/material (optional) |
description |
string | null
|
description, e.g. "Wire, Silver, Sterling, 20ga" |
unit |
string | null
|
usage/measurement unit (for unit conversion) |
rate | number |
the per unit cost of this lineItem |
amount | number |
amount of material/item useed |
HighValue | boolean |
boolean flag to indicate "High Value" (lower markup) commodities |
timestamp | datetime |
initial time of creation for sorting |
image |
url | null
|
a reference image for the lineItem |
object
LineItems~PaginatedFetch : An object to allow for paginating a table read from Firestore. REQUIRES a sorting choice
Kind: inner typedef of LineItems
Properties
Name | Type | Description |
---|---|---|
Query | Query |
that forms basis for the table read |
limit | number |
page size |
snapshot | QuerySnapshot |
last successful snapshot/page fetched |
status | enum |
status of pagination object |
PageForward | method |
pages the fetch forward |
PageBack | method |
pages the fetch backward |
Payment
"Payment Descriptor" handling operations. These descriptors represent paymentMethods, each tied to an individual user. These do not particularly represent a paymentProvider - they are meant as an abstraction above a specific payment processor.
-
Payment
-
static
-
.ERROR_TYPES :
Object
-
.PaymentDefault :
PaymentData
-
.paymentDescriptor :
PaymentDescriptorType
-
.receiptDefault :
ReceiptType
-
.createPaymentRecord(account, batch) ⇒
Promise.<(WriteBatch|Transaction|void)>
- .savePaymentData(paymentData)
- .fetchPayment(account, paymentData)
- .fetchPaymentByPerson(accountId, type, paymentData)
-
.addPaymentDescriptor(account, descriptor, batch) ⇒
Promise.PaymentDescriptorType
-
.savePaymentDescriptor(descriptor) ⇒
Promise.PaymentDescriptorType
-
.removePaymentDescriptor(account, descriptor) ⇒
Promise.<void>
-
.fetchPaymentDescriptors(account) ⇒
Promise.Array.PaymentDescriptor
-
.listPDSummaries(account) ⇒
Promise.Array.PDSummary
-
.fetchLatestPDSummary(account) ⇒
Promise.PaymentDescriptorType
-
.fetchPDByFingerprint(account, fingerprint) ⇒
Promise.<PDSummary>
-
.fetchPDByOwnerType(accountId, type, fingerprint) ⇒
Promise.<PDSummary>
-
.replaceDefaultPDSummary(account, PDSummary) ⇒
Promise.AccountObject
-
.saveReceiptRecord(account, receipt, batch) ⇒
Promise.ReceiptType
-
.updateReceipt(receipt) ⇒
Promise.ReceiptType
-
.saveReceiptRecordByOwnerType(ownerId, type, receipt, batch) ⇒
Promise.ReceiptType
-
.anyReceiptsByMonthStamp(account, monthStamp) ⇒
Promise.Array.ReceiptType
-
.saveReceiptRecordByChild(child, receipt, batch) ⇒
Promise.ReceiptType
-
.fetchReceiptsFiltered(account, filterArray, sortArray, limit) ⇒
Promise.Array.ReceiptType
-
.fetchProblemReceipts(account) ⇒
Promise.Array.ReceiptType
-
.fetchPledgeTicketReceipt(pledgeTicket) ⇒
Promise.ReceiptType
-
.markReceiptFromPledgeTicket(pledgeTicket, label) ⇒
Promise.ReceiptType
-
.markReceipt(receipt, label) ⇒
Promise.ReceiptType
-
.ERROR_TYPES :
-
inner
-
~fetchReceipt(account, receiptId) ⇒
Promise.ReceiptType
-
~PaymentData :
object
-
~PaymentDescriptorType :
object
-
~PDSummary :
object
-
~ReceiptType :
object
-
~AccountObject :
OrganizationType
|PersonObject
-
~fetchReceipt(account, receiptId) ⇒
-
static
Object
Payment.ERROR_TYPES : Kind: static constant of Payment
PaymentData
Payment.PaymentDefault : Kind: static constant of Payment
PaymentDescriptorType
Payment.paymentDescriptor : Kind: static constant of Payment
ReceiptType
Payment.receiptDefault : Kind: static constant of Payment
Promise.<(WriteBatch|Transaction|void)>
Payment.createPaymentRecord(account, batch) ⇒ Creates the Organization Payment information document
Kind: static method of Payment
Returns: Promise.<(WriteBatch|Transaction|void)>
- WriteBatch, Transaction or Void
Param | Type | Description |
---|---|---|
account | AccountObject |
|
batch |
WriteBatch | Transaction
|
batching object. Transaction will be added to the batch |
Payment.savePaymentData(paymentData)
Saves a payment data record to a given account (organization * or* person) ALL OF fans, artists and venues save the payment data in the same collection name under the parent, with the SAME Id as the parent PaymentData COMES FROM payement processor, and should INCLUDE the record Id and refPath
Kind: static method of Payment
Param | Type |
---|---|
paymentData | PaymentDataRecord |
Payment.fetchPayment(account, paymentData)
fetches a paymentData record from the database for an account ALL OF fans, artists and venues, etc save the payment data in the same collection name under the parent, with the SAME Id as the parent
Kind: static method of Payment
Param | Type |
---|---|
account | AccountType |
paymentData | Promise.PaymentData |
Payment.fetchPaymentByPerson(accountId, type, paymentData)
fetches a paymentData record from the database for an account when only accountID and type are known ALL OF fans, artists and venues save the payment data in the same collection name under the parent, with the SAME Id as the parent
Kind: static method of Payment
Param | Type |
---|---|
accountId | string |
type | string |
paymentData | Promise.PaymentData |
Promise.PaymentDescriptorType
Payment.addPaymentDescriptor(account, descriptor, batch) ⇒ Adds a specific paymentDescriptor to an account payment data
Kind: static method of Payment
Param | Type | Description |
---|---|---|
account | AccountType |
|
account.Id | string |
|
account.refPath | string |
|
descriptor | PaymentDescriptorType |
|
descriptor.paymentMethod | string |
|
descriptor.fingerprint | string |
|
descriptor.label | string |
|
batch |
WriteBatch | Transaction
|
batching object. Transaction will be added to the batch |
Promise.PaymentDescriptorType
Payment.savePaymentDescriptor(descriptor) ⇒ Saves a modified paymentDescriptor back to the database
Kind: static method of Payment
Param | Type |
---|---|
descriptor | PaymentDescriptorType |
descriptor.Id | string |
descriptor.refPath | string |
Promise.<void>
Payment.removePaymentDescriptor(account, descriptor) ⇒ Removes a paymentDescriptor from an account's paymentData
Kind: static method of Payment
Param | Type |
---|---|
account | AccountType |
descriptor | PaymentDescriptorType |
Promise.Array.PaymentDescriptor
Payment.fetchPaymentDescriptors(account) ⇒ fetch all customer card records IN OUR DATABASE (not payment database)
Kind: static method of Payment
Param | Type |
---|---|
account | AccountType |
account.refPath | string |
Promise.Array.PDSummary
Payment.listPDSummaries(account) ⇒ fetch the front-end list of paymentDescriptors
Kind: static method of Payment
Param | Type |
---|---|
account | AccountType |
account.Id | string |
account.refPath | string |
Promise.PaymentDescriptorType
Payment.fetchLatestPDSummary(account) ⇒ Kind: static method of Payment
Param | Type |
---|---|
account | AccountType |
account.Id | string |
account.refPath | string |
Promise.<PDSummary>
Payment.fetchPDByFingerprint(account, fingerprint) ⇒ retreives a PD, given the account Id and Type
Kind: static method of Payment
Param | Type |
---|---|
account | AccountType |
fingerprint | string |
Promise.<PDSummary>
Payment.fetchPDByOwnerType(accountId, type, fingerprint) ⇒ retreives a PD, given the account Id and Type
Kind: static method of Payment
Param | Type |
---|---|
accountId | string |
type | string |
fingerprint | string |
Promise.AccountObject
Payment.replaceDefaultPDSummary(account, PDSummary) ⇒ Copies a PDSummary tobe the new default (convenience function)
Kind: static method of Payment
Param | Type |
---|---|
account | AccountType |
PDSummary | PDSummary |
Promise.ReceiptType
Payment.saveReceiptRecord(account, receipt, batch) ⇒ Savess a Receipt to an account
Kind: static method of Payment
Param | Type | Description |
---|---|---|
account | AccountType |
|
receipt | ReceiptType |
|
batch |
WriteBatch | Transaction
|
batching object. Transaction will be added to the batch |
Promise.ReceiptType
Payment.updateReceipt(receipt) ⇒ Updates a (changed?) Receipt record
Kind: static method of Payment
Param | Type |
---|---|
receipt | ReceiptType |
Promise.ReceiptType
Payment.saveReceiptRecordByOwnerType(ownerId, type, receipt, batch) ⇒ Saves a new receipt to an account referrred by ID and type
Kind: static method of Payment
Param | Type | Description |
---|---|---|
ownerId | string |
|
type | string |
either ORGANIZATIONS or PEOPLE |
receipt | ReceiptType |
|
batch |
WriteBatch | Transaction
|
batching object. Transaction will be added to the batch |
Promise.Array.ReceiptType
Payment.anyReceiptsByMonthStamp(account, monthStamp) ⇒ Fetches an array of receipts in any particular month by monthStampt
Kind: static method of Payment
Param | Type |
---|---|
account | AccountObject |
monthStamp | dateString |
Promise.ReceiptType
Payment.saveReceiptRecordByChild(child, receipt, batch) ⇒ Saves a receipt by a child record reference
Kind: static method of Payment
Param | Type | Description |
---|---|---|
child | RecordDocument |
|
receipt | ReceiptType |
|
batch |
WriteBatch | Transaction
|
batching object. Transaction will be added to the batch |
Promise.Array.ReceiptType
Payment.fetchReceiptsFiltered(account, filterArray, sortArray, limit) ⇒ Fetches receipts based on a filter set
Kind: static method of Payment
Param | Type |
---|---|
account | AccountObject |
account.refPath | string |
filterArray | Array.filterObject |
sortArray | Array.sortObject |
limit | number |
Promise.Array.ReceiptType
Payment.fetchProblemReceipts(account) ⇒ Kind: static method of Payment
Param | Type |
---|---|
account | AccountObject |
account.refPath | string |
Promise.ReceiptType
Payment.fetchPledgeTicketReceipt(pledgeTicket) ⇒ Fetches the receipt for a pledgeTicket
Kind: static method of Payment
Param | Type |
---|---|
pledgeTicket | PledgeTicket |
Promise.ReceiptType
Payment.markReceiptFromPledgeTicket(pledgeTicket, label) ⇒ Changes the paidQ label on a receipt associated with a pledgeTicket
Kind: static method of Payment
Param | Type |
---|---|
pledgeTicket | pledgeTicketType |
label | string |
Promise.ReceiptType
Payment.markReceipt(receipt, label) ⇒ Changes the paidQ label on a receipt associated with a pledgeTicket
Kind: static method of Payment
Param | Type |
---|---|
receipt | receiptType |
label | string |
Promise.ReceiptType
Payment~fetchReceipt(account, receiptId) ⇒ Kind: inner method of Payment
Param | Type |
---|---|
account | AccountObject |
account.refPath | string |
receiptId | string |
object
Payment~PaymentData : Kind: inner typedef of Payment
Properties
Name | Type |
---|---|
Id | string |
payment_gateway | string |
status | string |
object
Payment~PaymentDescriptorType : Kind: inner typedef of Payment
Properties
Name | Type | Description |
---|---|---|
Id | string |
document Id of this Card Descriptor (same as fingerprint) |
paymentMethod | string |
Id of payment system card item |
fingerprint | string |
Unique hash of card info - for checking uniqueness |
label | string |
Brand & last4, or other descriptive |
expiry | string |
expiry date of payment method (if any) |
timestamp | timestamp |
last create or modify server time |
object
Payment~PDSummary : Kind: inner typedef of Payment
Properties
Name | Type | Description |
---|---|---|
Id | string |
document Id of this Card Descriptor |
label | string |
Brand & last4, or other descriptive |
object
Payment~ReceiptType : Kind: inner typedef of Payment
Properties
Name | Type | Description |
---|---|---|
Id | string |
same Id as the associated pledgeTicket |
amount | number |
|
payment | object |
|
link | string |
Id of associated payment_intent |
paidQ | string |
string describing status |
description | string |
supplemental information |
OrganizationType
| PersonObject
Payment~AccountObject : Kind: inner typedef of Payment
People
Typedefs, constants, support functions and database operations related to individual users
-
People
-
static
-
.createPerson ⇒
Promise.PersonObject
-
.deletePerson(person) ⇒
Promise.<void>
-
.deletePersonById(person) ⇒
Promise.<void>
-
.buildPersonRecords(user) ⇒
Promise.<void>
-
.updatePersonByID(person) ⇒
promise.PeopleObject
-
.updatePerson(person) ⇒
promise.PeopleObject
-
.knownPerson(Id) ⇒
Promise.boolean
-
.fetchPeople() ⇒
Array.PeopleObject
-
.fetchPeoplePaginated(limit) ⇒
PaginatedFetch
-
.fetchAnonymousPaginated(limit) ⇒
PaginatedFetch
-
.fetchPerson(personId) ⇒
Promise.PeopleObject
-
.fetchPersonName(personId) ⇒
Promise.string
-
.fetchPersonEmail(personId) ⇒
Promise.string
-
.fetchPersonPaymentById(personId) ⇒
Promise.PaymentData
-
.fetchUserByEmail(email) ⇒
Promise.PeopleObject
-
.fetchFullPerson(personIdentifier) ⇒
Promise.PeopleObject
-
.summarizePerson(person) ⇒
string
-
.fetchPersonFromChild(child) ⇒
Promise.PeopleObject
-
.personFromId(personId) ⇒
PeopleObject
-
.createPerson ⇒
-
inner
-
~PeopleDefault :
PersonObject
-
~PeopleDefaultForm :
PersonObject
-
~PersonObject :
object
-
~PaginatedFetch :
object
-
~PeopleDefault :
-
static
Promise.PersonObject
People.createPerson ⇒ Kind: static constant of People
Param | Type | Description |
---|---|---|
person | PersonObject |
minimal record of user account |
Promise.<void>
People.deletePerson(person) ⇒ Kind: static method of People
Param | Type |
---|---|
person | PersonObject |
Promise.<void>
People.deletePersonById(person) ⇒ Kind: static method of People
Param | Type | Description |
---|---|---|
person | PersonObject |
minimal record of user account |
person.Id | string |
record Id of account |
Promise.<void>
People.buildPersonRecords(user) ⇒ Builds a Person record from the authentication "user" data
Kind: static method of People
Param | Type |
---|---|
user | User |
user.isAnonymous | boolean |
user.displayName | string |
user.photoURL | string |
user.email | string |
user.phoneNumber | string |
promise.PeopleObject
People.updatePersonByID(person) ⇒ writes record back to database. Assumes only Id is valid
Kind: static method of People
Returns: promise.PeopleObject
- a copy of the data written
Param | Type | Description |
---|---|---|
person | PeopleObject |
a p[artially-populated people record for updates] |
promise.PeopleObject
People.updatePerson(person) ⇒ writes record back to database. Assumes only Id is valid
Kind: static method of People
Returns: promise.PeopleObject
- a copy of the data written
Param | Type | Description |
---|---|---|
person | PeopleObject |
a p[artially-populated people record for updates] |
Promise.boolean
People.knownPerson(Id) ⇒ Checks if this is a known PersonObject Id
Kind: static method of People
Returns: Promise.boolean
- true is this Id is in database
Param | Type | Description |
---|---|---|
Id | string |
Id value to check |
Array.PeopleObject
People.fetchPeople() ⇒ Fecthes ALL people records. Not very useful
Kind: static method of People
PaginatedFetch
People.fetchPeoplePaginated(limit) ⇒ Fetchs an object to fetch pages of people data, ascending by name, "limit" at a time
Kind: static method of People
Returns: PaginatedFetch
- object with pagination methods
Param | Type |
---|---|
limit | number |
PaginatedFetch
People.fetchAnonymousPaginated(limit) ⇒ Fetchs an object to fetch pages of anonymous people data, ascending by name, "limit" at a time
Kind: static method of People
Returns: PaginatedFetch
- object with pagination methods
Param | Type |
---|---|
limit | number |
Promise.PeopleObject
People.fetchPerson(personId) ⇒ Fetches a single PeopleObject record by Id
Kind: static method of People
Param | Type |
---|---|
personId | string |
Promise.string
People.fetchPersonName(personId) ⇒ Fetches and returns the summarized name from a PeopleObject record
Kind: static method of People
Returns: Promise.string
- the summarized name from the record
Param | Type |
---|---|
personId | string |
Promise.string
People.fetchPersonEmail(personId) ⇒ Fetches and returns the email from a PeopleObject record
Kind: static method of People
Returns: Promise.string
- the email from the record
Param | Type |
---|---|
personId | string |
Promise.PaymentData
People.fetchPersonPaymentById(personId) ⇒ Fetches the PaymentRecord for a person using just the ID
Kind: static method of People
Param | Type |
---|---|
personId | string |
Promise.PeopleObject
People.fetchUserByEmail(email) ⇒ Fetch a People record by their email
Kind: static method of People
Param | Type |
---|---|
string |
Promise.PeopleObject
People.fetchFullPerson(personIdentifier) ⇒ fetches a full person object (address, payment, private, etc) given EITHER just the Id, OR a PersonObject
Kind: static method of People
Param | Type |
---|---|
personIdentifier |
string | PersonObject
|
personIdentifier.Id | string |
string
People.summarizePerson(person) ⇒ Returns a standardized formatted name string
Kind: static method of People
Returns: string
- formatted name string
Param | Type |
---|---|
person | PeopleObject |
Promise.PeopleObject
People.fetchPersonFromChild(child) ⇒ Fetches a PersonObject from any child record in any branch
Kind: static method of People
Param | Type |
---|---|
child | RecordDocument |
PeopleObject
People.personFromId(personId) ⇒ builds a minimal PeopleObject from an Id
Kind: static method of People
Param | Type |
---|---|
personId | string |
PersonObject
People~PeopleDefault : Kind: inner constant of People
Default: {"Id":null,"refPath":null,"name":null,"email":null,"tel":null,"isAnonymous":true,"payment_method":null,"admin_status":null}
Read only: true
PersonObject
People~PeopleDefaultForm : Kind: inner constant of People
Default: {"name":"text","email":"email","tel":"tel"}
Read only: true
object
People~PersonObject : Kind: inner typedef of People
Properties
Name | Type | Description |
---|---|---|
Id | string |
Id of document from storage |
refPath | string |
if from database, full path to document |
first_name | string |
could be "Anonymous" |
last_name | string |
|
isAnonymous | boolean |
flag indicating auto-generated Anonymous user account |
image | url |
URL (possibly in app storage) of User image |
region | string |
User home region, from fixed list |
[social_links] | url |
array of user social account links |
bio | string |
user-maintained biography |
website | url |
URL to user personal website |
payment_method | string |
summary string of user payment method. Not secure, not source-of-truth |
payment | PaymentData |
when "full account" |
object
People~PaginatedFetch : An object to allow for paginating a table read from Firestore. REQUIRES a sorting choice
Kind: inner typedef of People
Properties
Name | Type | Description |
---|---|---|
Query | Query |
that forms basis for the table read |
limit | number |
page size |
snapshot | QuerySnapshot |
last successful snapshot/page fetched |
status | enum |
status of pagination object |
PageForward | method |
pages the fetch forward |
PageBack | method |
pages the fetch backward |
Product
Typedefs, constants, support functions and database operations related to Products
-
Product
-
static
-
.saveProduct(person) ⇒
Promise.<void>
-
.saveProduct(person) ⇒
-
inner
-
~ProductDefault :
Product
-
~ProductDefaultForm :
Product
-
~Product :
object
-
~ProductDefault :
-
static
Promise.<void>
Product.saveProduct(person) ⇒ Saves a Product object to the database
Kind: static method of Product
Param | Type | Description |
---|---|---|
person | Person |
minimal record of person this commodity belongs to (if any) |
Properties
Name | Type |
---|---|
product | Product |
Product
Product~ProductDefault : Kind: inner constant of Product
Default: {"Id":null,"refPath":null,"name":""}
Read only: true
Product
Product~ProductDefaultForm : Kind: inner constant of Product
Default: {"name":"text"}
Read only: true
object
Product~Product : a record
Kind: inner typedef of Product
Properties
Name | Type | Description |
---|---|---|
Id | string |
Id of document (redundant for convenience) |
refPath | string |
if from database, full path to document |
name | number |
name for the Product |
Stages
Typedefs, constants, support functions and database operations related to product creation stages users
-
Stages
-
static
-
.saveStage(parent) ⇒
Promise.<void>
-
.saveStage(parent) ⇒
-
inner
-
~StageDefault :
Stage
-
~StageDefaultForm :
Stage
-
~Stage :
object
-
~StageDefault :
-
static
Promise.<void>
Stages.saveStage(parent) ⇒ Saves a default Stage Settings object to the database
Kind: static method of Stages
Param | Type | Description |
---|---|---|
parent |
Person | Product
|
minimal record of person this commodity belongs to (if any) |
Properties
Name | Type |
---|---|
stage | Stage |
Stage
Stages~StageDefault : Kind: inner constant of Stages
Default: {"Id":null,"refPath":null,"base":2.5,"highValue":1.5,"overhead":5,"rate":20,"unit":"hour","hours":0,"minutes":0,"stage":"fabrication"}
Read only: true
Stage
Stages~StageDefaultForm : Kind: inner constant of Stages
Default: {"base":"number","highValue":"number","overhead":"number","rate":"number","unit":"lookup","hours":"number","minutes":"number","stage":"lookup"}
Read only: true
object
Stages~Stage : a record
Kind: inner typedef of Stages
Properties
Name | Type | Description |
---|---|---|
Id | string |
Id of document (redundant for convenience) |
refPath | string |
if from database, full path to document |
base | number |
Multiplier/Markup from this stage to the next |
highValue | number |
Multiplier/Markup for hgih value materials/items from this stage to the next |
overhead | number |
unit charge for business overhead |
rate | number |
unit charge for direct labor expenses |
unit | string |
lookup unit of measure for overhead and rate |
hours | number |
actual hours of labor at this stage |
minutes | number |
actual minutes of labor at this stage |
stage | number |
lookup name of corresponding production stage |
Boilerplate
Shared constants and symbols
AccountType
Boilerplate.recordByIdAndType ⇒ creates and returns a minimal record from an Id and type
Kind: static constant of Boilerplate
Param | Type |
---|---|
Id | string |
Type | string |
© 2020-2023 Tracy Hall / Dreams and Logic Inc / SaltSweetSpirits