@leaddreamer/inventorylogic 0.0.3-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.hbs +13 -0
- package/README.md +1948 -0
- package/business/Commodities/index.js +240 -0
- package/business/LineItem/index.js +328 -0
- package/business/Markups/index.js +183 -0
- package/business/Payment/index.js +516 -0
- package/business/Product/index.js +142 -0
- package/business/User/index.js +372 -0
- package/business/Utilities/index.js +336 -0
- package/business/boilerplate/index.js +55 -0
- package/business/index.js +14 -0
- package/business/units/index.js +94 -0
- package/index.js +61 -0
- package/package.json +72 -0
package/README.md
ADDED
|
@@ -0,0 +1,1948 @@
|
|
|
1
|
+
[](https://www.npmjs.org/package/@leaddreamer/inventorylogic)
|
|
3
|
+
# @SaltSweetSpirits/InventoryLogic
|
|
4
|
+
|
|
5
|
+
Business Logic for the Inventory system, wrapped around FirebaseWrapper,
|
|
6
|
+
to be shared between Back and Front End. This particular library only provides the
|
|
7
|
+
business "logic" - not browser services.
|
|
8
|
+
|
|
9
|
+
## Modules
|
|
10
|
+
|
|
11
|
+
<dl>
|
|
12
|
+
<dt><a href="#module_Boilerplate">Boilerplate</a></dt>
|
|
13
|
+
<dd><p>Shared constants and symbols</p>
|
|
14
|
+
</dd>
|
|
15
|
+
<dt><a href="#module_Commodities">Commodities</a></dt>
|
|
16
|
+
<dd><p>Typedefs, constants, support functions and database operations related to Commodity Matrials
|
|
17
|
+
users</p>
|
|
18
|
+
</dd>
|
|
19
|
+
<dt><a href="#module_InventoryLogic">InventoryLogic</a></dt>
|
|
20
|
+
<dd><p>A collection of Business logic and database functions. Shared between ReactJS
|
|
21
|
+
frontEnd and NodeJS BackEnd</p>
|
|
22
|
+
</dd>
|
|
23
|
+
<dt><a href="#module_LineItem">LineItem</a></dt>
|
|
24
|
+
<dd><p>Typedefs, constants, support functions and database operations related to LineItem Matrials
|
|
25
|
+
users</p>
|
|
26
|
+
</dd>
|
|
27
|
+
<dt><a href="#module_Markups">Markups</a></dt>
|
|
28
|
+
<dd><p>Typedefs, constants, support functions and database operations related to product creation stages
|
|
29
|
+
users</p>
|
|
30
|
+
</dd>
|
|
31
|
+
<dt><a href="#module_Payment">Payment</a></dt>
|
|
32
|
+
<dd><p>"Payment Descriptor" handling operations. These descriptors represent paymentMethods, each tied
|
|
33
|
+
to an individual user. These do not <em>particularly</em> represent a paymentProvider - they are meant
|
|
34
|
+
as an abstraction above a specific payment processor.</p>
|
|
35
|
+
</dd>
|
|
36
|
+
<dt><a href="#module_Product">Product</a></dt>
|
|
37
|
+
<dd><p>Typedefs, constants, support functions and database operations related to Products</p>
|
|
38
|
+
</dd>
|
|
39
|
+
<dt><a href="#module_Units">Units</a></dt>
|
|
40
|
+
<dd><p>Typedefs, constants, support functions and database operations related to usage Units
|
|
41
|
+
and conversions</p>
|
|
42
|
+
</dd>
|
|
43
|
+
<dt><a href="#module_User">User</a></dt>
|
|
44
|
+
<dd><p>Typedefs, constants, support functions and database operations related to individual
|
|
45
|
+
users</p>
|
|
46
|
+
</dd>
|
|
47
|
+
<dt><a href="#module_Utilities">Utilities</a></dt>
|
|
48
|
+
<dd><p>Typedefs, constants, support functions and database operations related to usage Units
|
|
49
|
+
and conversions</p>
|
|
50
|
+
</dd>
|
|
51
|
+
<dt><a href="#module_InventoryLogic">InventoryLogic</a></dt>
|
|
52
|
+
<dd><p>Business Logic for the PaaS, wrapped
|
|
53
|
+
around FirebaseWrapper, to be shared between Back and Front End.
|
|
54
|
+
This particular library only provides the business "logic" - not browser
|
|
55
|
+
services.</p>
|
|
56
|
+
</dd>
|
|
57
|
+
</dl>
|
|
58
|
+
|
|
59
|
+
<a name="module_Boilerplate"></a>
|
|
60
|
+
|
|
61
|
+
## Boilerplate
|
|
62
|
+
Shared constants and symbols
|
|
63
|
+
|
|
64
|
+
<a name="module_Commodities"></a>
|
|
65
|
+
|
|
66
|
+
## Commodities
|
|
67
|
+
Typedefs, constants, support functions and database operations related to Commodity Matrials
|
|
68
|
+
users
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
* [Commodities](#module_Commodities)
|
|
72
|
+
* _static_
|
|
73
|
+
* [.createCommodity](#module_Commodities.createCommodity) ⇒ <code>Promise.Commodity</code>
|
|
74
|
+
* [.deleteCommodity(commodity, user)](#module_Commodities.deleteCommodity) ⇒ <code>Promise.<void></code>
|
|
75
|
+
* [.deleteCommodityById(commodity, user)](#module_Commodities.deleteCommodityById) ⇒ <code>Promise.<void></code>
|
|
76
|
+
* [.updateCommodityByID(commodity, user)](#module_Commodities.updateCommodityByID) ⇒ <code>promise.Commodity</code>
|
|
77
|
+
* [.updateCommodity(commodity, user)](#module_Commodities.updateCommodity) ⇒ <code>promise.Commodity</code>
|
|
78
|
+
* [.knownCommodity(Id, user)](#module_Commodities.knownCommodity) ⇒ <code>Promise.boolean</code>
|
|
79
|
+
* [.fetchCommodities(user)](#module_Commodities.fetchCommodities) ⇒ <code>Array.Commodity</code>
|
|
80
|
+
* [.fetchCommoditiesPaginated(limit, user)](#module_Commodities.fetchCommoditiesPaginated) ⇒ <code>PaginatedFetch</code>
|
|
81
|
+
* [.fetchCommodity(commodityId, user)](#module_Commodities.fetchCommodity) ⇒ <code>Promise.Commodity</code>
|
|
82
|
+
* [.fetchCommodityName(commodityId, user)](#module_Commodities.fetchCommodityName) ⇒ <code>Promise.string</code>
|
|
83
|
+
* _inner_
|
|
84
|
+
* [~CommodityDefault](#module_Commodities..CommodityDefault) : <code>Commodity</code>
|
|
85
|
+
* [~CommodityData](#module_Commodities..CommodityData) : <code>Commodity</code>
|
|
86
|
+
* [~CommodityDefaultForm](#module_Commodities..CommodityDefaultForm) : <code>Commodity</code>
|
|
87
|
+
* [~summarizeCommodity(commodity)](#module_Commodities..summarizeCommodity) ⇒ <code>string</code>
|
|
88
|
+
* [~Commodity](#module_Commodities..Commodity) : <code>object</code>
|
|
89
|
+
* [~PaginatedFetch](#module_Commodities..PaginatedFetch) : <code>object</code>
|
|
90
|
+
|
|
91
|
+
<a name="module_Commodities.createCommodity"></a>
|
|
92
|
+
|
|
93
|
+
### Commodities.createCommodity ⇒ <code>Promise.Commodity</code>
|
|
94
|
+
**Kind**: static constant of [<code>Commodities</code>](#module_Commodities)
|
|
95
|
+
|
|
96
|
+
| Param | Type | Description |
|
|
97
|
+
| --- | --- | --- |
|
|
98
|
+
| commodity | <code>Commodity</code> | minimal record of user account |
|
|
99
|
+
| user | <code>UserObject</code> | minimal record of user this commodity belongs to (if any) |
|
|
100
|
+
|
|
101
|
+
<a name="module_Commodities.deleteCommodity"></a>
|
|
102
|
+
|
|
103
|
+
### Commodities.deleteCommodity(commodity, user) ⇒ <code>Promise.<void></code>
|
|
104
|
+
**Kind**: static method of [<code>Commodities</code>](#module_Commodities)
|
|
105
|
+
|
|
106
|
+
| Param | Type | Description |
|
|
107
|
+
| --- | --- | --- |
|
|
108
|
+
| commodity | <code>CommodityDefault</code> | |
|
|
109
|
+
| user | <code>UserObject</code> | minimal record of user this commodity belongs to (if any) |
|
|
110
|
+
|
|
111
|
+
<a name="module_Commodities.deleteCommodityById"></a>
|
|
112
|
+
|
|
113
|
+
### Commodities.deleteCommodityById(commodity, user) ⇒ <code>Promise.<void></code>
|
|
114
|
+
**Kind**: static method of [<code>Commodities</code>](#module_Commodities)
|
|
115
|
+
|
|
116
|
+
| Param | Type | Description |
|
|
117
|
+
| --- | --- | --- |
|
|
118
|
+
| commodity | <code>CommodityDefault</code> | minimal record of user account |
|
|
119
|
+
| commodity.Id | <code>string</code> | record Id of account |
|
|
120
|
+
| user | <code>UserObject</code> | minimal record of user this commodity belongs to (if any) |
|
|
121
|
+
|
|
122
|
+
<a name="module_Commodities.updateCommodityByID"></a>
|
|
123
|
+
|
|
124
|
+
### Commodities.updateCommodityByID(commodity, user) ⇒ <code>promise.Commodity</code>
|
|
125
|
+
writes record back to database. Assumes only Id is valid
|
|
126
|
+
|
|
127
|
+
**Kind**: static method of [<code>Commodities</code>](#module_Commodities)
|
|
128
|
+
**Returns**: <code>promise.Commodity</code> - a copy of the data written
|
|
129
|
+
|
|
130
|
+
| Param | Type | Description |
|
|
131
|
+
| --- | --- | --- |
|
|
132
|
+
| commodity | <code>Commodity</code> | a partially-populated commodity record for updates |
|
|
133
|
+
| user | <code>UserObject</code> | minimal record of user this commodity belongs to (if any) |
|
|
134
|
+
|
|
135
|
+
<a name="module_Commodities.updateCommodity"></a>
|
|
136
|
+
|
|
137
|
+
### Commodities.updateCommodity(commodity, user) ⇒ <code>promise.Commodity</code>
|
|
138
|
+
writes record back to database. Assumes only Id is valid
|
|
139
|
+
|
|
140
|
+
**Kind**: static method of [<code>Commodities</code>](#module_Commodities)
|
|
141
|
+
**Returns**: <code>promise.Commodity</code> - a copy of the data written
|
|
142
|
+
|
|
143
|
+
| Param | Type | Description |
|
|
144
|
+
| --- | --- | --- |
|
|
145
|
+
| commodity | <code>Commodity</code> | a partially-populated commodity record for updates |
|
|
146
|
+
| user | <code>UserObject</code> | minimal record of user this commodity belongs to (if any) |
|
|
147
|
+
|
|
148
|
+
<a name="module_Commodities.knownCommodity"></a>
|
|
149
|
+
|
|
150
|
+
### Commodities.knownCommodity(Id, user) ⇒ <code>Promise.boolean</code>
|
|
151
|
+
Checks if this is a known Commodity Id
|
|
152
|
+
|
|
153
|
+
**Kind**: static method of [<code>Commodities</code>](#module_Commodities)
|
|
154
|
+
**Returns**: <code>Promise.boolean</code> - true is this Id is in database
|
|
155
|
+
|
|
156
|
+
| Param | Type | Description |
|
|
157
|
+
| --- | --- | --- |
|
|
158
|
+
| Id | <code>string</code> | Id value to check |
|
|
159
|
+
| user | <code>UserObject</code> | minimal record of user this commodity belongs to (if any) |
|
|
160
|
+
|
|
161
|
+
<a name="module_Commodities.fetchCommodities"></a>
|
|
162
|
+
|
|
163
|
+
### Commodities.fetchCommodities(user) ⇒ <code>Array.Commodity</code>
|
|
164
|
+
Fetches ALL Commodity records. Not very useful
|
|
165
|
+
|
|
166
|
+
**Kind**: static method of [<code>Commodities</code>](#module_Commodities)
|
|
167
|
+
|
|
168
|
+
| Param | Type | Description |
|
|
169
|
+
| --- | --- | --- |
|
|
170
|
+
| user | <code>UserObject</code> | minimal record of user this commodity belongs to (if any) |
|
|
171
|
+
|
|
172
|
+
<a name="module_Commodities.fetchCommoditiesPaginated"></a>
|
|
173
|
+
|
|
174
|
+
### Commodities.fetchCommoditiesPaginated(limit, user) ⇒ <code>PaginatedFetch</code>
|
|
175
|
+
Fetchs an object to fetch pages of commodity data, ascending by name, "limit" at a time
|
|
176
|
+
|
|
177
|
+
**Kind**: static method of [<code>Commodities</code>](#module_Commodities)
|
|
178
|
+
**Returns**: <code>PaginatedFetch</code> - object with pagination methods
|
|
179
|
+
|
|
180
|
+
| Param | Type | Description |
|
|
181
|
+
| --- | --- | --- |
|
|
182
|
+
| limit | <code>number</code> | |
|
|
183
|
+
| user | <code>UserObject</code> | minimal record of user this commodity belongs to (if any) |
|
|
184
|
+
|
|
185
|
+
<a name="module_Commodities.fetchCommodity"></a>
|
|
186
|
+
|
|
187
|
+
### Commodities.fetchCommodity(commodityId, user) ⇒ <code>Promise.Commodity</code>
|
|
188
|
+
Fetches a single Commodity record by Id
|
|
189
|
+
|
|
190
|
+
**Kind**: static method of [<code>Commodities</code>](#module_Commodities)
|
|
191
|
+
|
|
192
|
+
| Param | Type | Description |
|
|
193
|
+
| --- | --- | --- |
|
|
194
|
+
| commodityId | <code>string</code> | |
|
|
195
|
+
| user | <code>UserObject</code> | minimal record of user this commodity belongs to (if any) |
|
|
196
|
+
|
|
197
|
+
<a name="module_Commodities.fetchCommodityName"></a>
|
|
198
|
+
|
|
199
|
+
### Commodities.fetchCommodityName(commodityId, user) ⇒ <code>Promise.string</code>
|
|
200
|
+
Fetches and returns the summarized name from a Commodity record
|
|
201
|
+
|
|
202
|
+
**Kind**: static method of [<code>Commodities</code>](#module_Commodities)
|
|
203
|
+
**Returns**: <code>Promise.string</code> - the summarized name from the record
|
|
204
|
+
|
|
205
|
+
| Param | Type | Description |
|
|
206
|
+
| --- | --- | --- |
|
|
207
|
+
| commodityId | <code>string</code> | |
|
|
208
|
+
| user | <code>UserObject</code> | minimal record of user this commodity belongs to (if any) |
|
|
209
|
+
|
|
210
|
+
<a name="module_Commodities..CommodityDefault"></a>
|
|
211
|
+
|
|
212
|
+
### Commodities~CommodityDefault : <code>Commodity</code>
|
|
213
|
+
**Kind**: inner constant of [<code>Commodities</code>](#module_Commodities)
|
|
214
|
+
**Default**: <code>{"Id":null,"refPath":null,"description":null,"unit":null,"rate":0,"MATERIAL":null,"image":null}</code>
|
|
215
|
+
**Read only**: true
|
|
216
|
+
<a name="module_Commodities..CommodityData"></a>
|
|
217
|
+
|
|
218
|
+
### Commodities~CommodityData : <code>Commodity</code>
|
|
219
|
+
**Kind**: inner constant of [<code>Commodities</code>](#module_Commodities)
|
|
220
|
+
**Default**: <code>{"Id":"","refPath":null,"description":"","unit":"","rate":"","MATERIAL":"","image":null}</code>
|
|
221
|
+
**Read only**: true
|
|
222
|
+
<a name="module_Commodities..CommodityDefaultForm"></a>
|
|
223
|
+
|
|
224
|
+
### Commodities~CommodityDefaultForm : <code>Commodity</code>
|
|
225
|
+
**Kind**: inner constant of [<code>Commodities</code>](#module_Commodities)
|
|
226
|
+
**Default**: <code>{"description":"text","unit":"","rate":"number","MATERIAL":"","image":"url"}</code>
|
|
227
|
+
**Read only**: true
|
|
228
|
+
<a name="module_Commodities..summarizeCommodity"></a>
|
|
229
|
+
|
|
230
|
+
### Commodities~summarizeCommodity(commodity) ⇒ <code>string</code>
|
|
231
|
+
Returns a standardized formatted name string
|
|
232
|
+
|
|
233
|
+
**Kind**: inner method of [<code>Commodities</code>](#module_Commodities)
|
|
234
|
+
**Returns**: <code>string</code> - formatted name string
|
|
235
|
+
|
|
236
|
+
| Param | Type |
|
|
237
|
+
| --- | --- |
|
|
238
|
+
| commodity | <code>Commodity</code> |
|
|
239
|
+
|
|
240
|
+
<a name="module_Commodities..Commodity"></a>
|
|
241
|
+
|
|
242
|
+
### Commodities~Commodity : <code>object</code>
|
|
243
|
+
a record
|
|
244
|
+
|
|
245
|
+
**Kind**: inner typedef of [<code>Commodities</code>](#module_Commodities)
|
|
246
|
+
**Properties**
|
|
247
|
+
|
|
248
|
+
| Name | Type | Description |
|
|
249
|
+
| --- | --- | --- |
|
|
250
|
+
| Id | <code>string</code> | Id of document (redundant for convenience) |
|
|
251
|
+
| refPath | <code>string</code> | if from database, full path to document |
|
|
252
|
+
| description | <code>string</code> | description, e.g. "Wire, Silver, Sterling, 20ga" |
|
|
253
|
+
| unit | <code>string</code> | usage/measurement unit (for unit conversion) |
|
|
254
|
+
| rate | <code>number</code> | the per unit cost of this commodity |
|
|
255
|
+
| MATERIAL | <code>string</code> | "base", "highValue" or other value tp be defined |
|
|
256
|
+
| image | <code>url</code> | a reference image for the commodity |
|
|
257
|
+
|
|
258
|
+
<a name="module_Commodities..PaginatedFetch"></a>
|
|
259
|
+
|
|
260
|
+
### Commodities~PaginatedFetch : <code>object</code>
|
|
261
|
+
An object to allow for paginating a table read from Firestore. REQUIRES a sorting choice
|
|
262
|
+
|
|
263
|
+
**Kind**: inner typedef of [<code>Commodities</code>](#module_Commodities)
|
|
264
|
+
**Properties**
|
|
265
|
+
|
|
266
|
+
| Name | Type | Description |
|
|
267
|
+
| --- | --- | --- |
|
|
268
|
+
| Query | <code>Query</code> | that forms basis for the table read |
|
|
269
|
+
| limit | <code>number</code> | page size |
|
|
270
|
+
| snapshot | <code>QuerySnapshot</code> | last successful snapshot/page fetched |
|
|
271
|
+
| status | <code>enum</code> | status of pagination object |
|
|
272
|
+
| PageForward | <code>method</code> | pages the fetch forward |
|
|
273
|
+
| PageBack | <code>method</code> | pages the fetch backward |
|
|
274
|
+
|
|
275
|
+
<a name="module_InventoryLogic"></a>
|
|
276
|
+
|
|
277
|
+
## InventoryLogic
|
|
278
|
+
A collection of Business logic and database functions. Shared between ReactJS
|
|
279
|
+
frontEnd and NodeJS BackEnd
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
* [InventoryLogic](#module_InventoryLogic)
|
|
283
|
+
* _static_
|
|
284
|
+
* [.databaseStart(firebase, config, thisLogger)](#module_InventoryLogic.databaseStart) ⇒ <code>Promise.Firebase.app</code>
|
|
285
|
+
* _inner_
|
|
286
|
+
* [~FirebaseConfigObject](#module_InventoryLogic..FirebaseConfigObject) : <code>object</code>
|
|
287
|
+
|
|
288
|
+
<a name="module_InventoryLogic.databaseStart"></a>
|
|
289
|
+
|
|
290
|
+
### InventoryLogic.databaseStart(firebase, config, thisLogger) ⇒ <code>Promise.Firebase.app</code>
|
|
291
|
+
all-in-one wrapper for a solid subset of CLIENT-SIDE Firebase
|
|
292
|
+
functions, with a consistent interface. There is a parallel set for
|
|
293
|
+
ADMIN-SIDE functions as well.
|
|
294
|
+
Call/initialize with Firebase Configuration settings in an object as
|
|
295
|
+
described below
|
|
296
|
+
|
|
297
|
+
**Kind**: static method of [<code>InventoryLogic</code>](#module_InventoryLogic)
|
|
298
|
+
|
|
299
|
+
| Param | Type | Description |
|
|
300
|
+
| --- | --- | --- |
|
|
301
|
+
| firebase | <code>Firebase</code> | |
|
|
302
|
+
| config | <code>FirebaseConfigObject</code> | Firebase Admin object |
|
|
303
|
+
| thisLogger | <code>callback</code> | |
|
|
304
|
+
|
|
305
|
+
**Example**
|
|
306
|
+
```
|
|
307
|
+
//this specifically loads ALL the subsections, specifically for
|
|
308
|
+
//the Browser. See later (tbd) notes for NodeJS
|
|
309
|
+
|
|
310
|
+
import FirebaseWrapper from "@leaddreamer/firebase-wrapper";
|
|
311
|
+
FirebaseWrapper(config); //see below
|
|
312
|
+
export * from "@leaddreamer/firebase-wrapper";
|
|
313
|
+
```
|
|
314
|
+
<a name="module_InventoryLogic..FirebaseConfigObject"></a>
|
|
315
|
+
|
|
316
|
+
### InventoryLogic~FirebaseConfigObject : <code>object</code>
|
|
317
|
+
only authDomain, databaseURL and storageBucket are present when
|
|
318
|
+
called from a cloud environment
|
|
319
|
+
|
|
320
|
+
**Kind**: inner typedef of [<code>InventoryLogic</code>](#module_InventoryLogic)
|
|
321
|
+
**Properties**
|
|
322
|
+
|
|
323
|
+
| Name | Type | Description |
|
|
324
|
+
| --- | --- | --- |
|
|
325
|
+
| apiKey | <code>string</code> | required api Key from Firebase Console, |
|
|
326
|
+
| appId | <code>string</code> | required app ID from Firebase Console |
|
|
327
|
+
| projectId | <code>string</code> | required Firebase projectID from Firebase console |
|
|
328
|
+
| authDomain | <code>string</code> | (optional) auth domain from Firebase Console |
|
|
329
|
+
| databaseURL | <code>string</code> | (optional) Firestore database URL from Firebase console |
|
|
330
|
+
| storageBucket: | <code>string</code> | (optional) URL of Firestore Storage Bucket |
|
|
331
|
+
| messagingSenderId: | <code>string</code> | (optional) ID for Messaing service from Firebase Console |
|
|
332
|
+
| measurementId: | <code>string</code> | (optional) Analytics/Measurement ID from Firebase Console |
|
|
333
|
+
| mapsAPIKey | <code>string</code> | (optional) App ID for Google Maps API, from Google |
|
|
334
|
+
|
|
335
|
+
<a name="module_LineItem"></a>
|
|
336
|
+
|
|
337
|
+
## LineItem
|
|
338
|
+
Typedefs, constants, support functions and database operations related to LineItem Matrials
|
|
339
|
+
users
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
* [LineItem](#module_LineItem)
|
|
343
|
+
* _static_
|
|
344
|
+
* [.createLineItem](#module_LineItem.createLineItem) ⇒ <code>Promise.LineItem</code>
|
|
345
|
+
* [.deleteLineItem(lineItem, product)](#module_LineItem.deleteLineItem) ⇒ <code>Promise.<void></code>
|
|
346
|
+
* [.deleteLineItemById(lineItem, product)](#module_LineItem.deleteLineItemById) ⇒ <code>Promise.<void></code>
|
|
347
|
+
* [.knownLineItem(Id, product)](#module_LineItem.knownLineItem) ⇒ <code>Promise.boolean</code>
|
|
348
|
+
* [.fetchLineItems()](#module_LineItem.fetchLineItems) ⇒ <code>Array.LineItem</code>
|
|
349
|
+
* [.fetchProductLineItems(product, stage)](#module_LineItem.fetchProductLineItems) ⇒ <code>Array.LineItem</code>
|
|
350
|
+
* [.paginateProductLineItems(product, stage, limit)](#module_LineItem.paginateProductLineItems) ⇒ <code>PaginatedFetch</code>
|
|
351
|
+
* [.fetchLineItem(lineItemId, product)](#module_LineItem.fetchLineItem) ⇒ <code>Promise.LineItem</code>
|
|
352
|
+
* [.fetchLineItemName(lineItemId, product)](#module_LineItem.fetchLineItemName) ⇒ <code>Promise.string</code>
|
|
353
|
+
* _inner_
|
|
354
|
+
* [~LineItemDefault](#module_LineItem..LineItemDefault) : <code>LineItem</code>
|
|
355
|
+
* [~LineItemData](#module_LineItem..LineItemData) : <code>LineItem</code>
|
|
356
|
+
* [~LineItemDefaultForm](#module_LineItem..LineItemDefaultForm) : <code>LineItem</code>
|
|
357
|
+
* [~updateLineItem(lineItem, product)](#module_LineItem..updateLineItem) ⇒ <code>promise.LineItem</code>
|
|
358
|
+
* [~summarizeLineItem(lineItem)](#module_LineItem..summarizeLineItem) ⇒ <code>string</code>
|
|
359
|
+
* [~lineItem_lineSum(lineItem)](#module_LineItem..lineItem_lineSum) ⇒ <code>number</code>
|
|
360
|
+
* [~UpdateChange(prev, value, itemFor, fullChoiceObject)](#module_LineItem..UpdateChange) ⇒ <code>object</code>
|
|
361
|
+
* [~LineItem](#module_LineItem..LineItem) : <code>object</code>
|
|
362
|
+
* [~PaginatedFetch](#module_LineItem..PaginatedFetch) : <code>object</code>
|
|
363
|
+
|
|
364
|
+
<a name="module_LineItem.createLineItem"></a>
|
|
365
|
+
|
|
366
|
+
### LineItem.createLineItem ⇒ <code>Promise.LineItem</code>
|
|
367
|
+
**Kind**: static constant of [<code>LineItem</code>](#module_LineItem)
|
|
368
|
+
|
|
369
|
+
| Param | Type | Description |
|
|
370
|
+
| --- | --- | --- |
|
|
371
|
+
| lineItem | <code>LineItem</code> | minimal record of user account |
|
|
372
|
+
| product | <code>Product</code> | minimal record of product this lineItem belongs to |
|
|
373
|
+
|
|
374
|
+
<a name="module_LineItem.deleteLineItem"></a>
|
|
375
|
+
|
|
376
|
+
### LineItem.deleteLineItem(lineItem, product) ⇒ <code>Promise.<void></code>
|
|
377
|
+
deletes a lineItem. Product required if lineItem is missing refPath
|
|
378
|
+
from database
|
|
379
|
+
|
|
380
|
+
**Kind**: static method of [<code>LineItem</code>](#module_LineItem)
|
|
381
|
+
|
|
382
|
+
| Param | Type | Description |
|
|
383
|
+
| --- | --- | --- |
|
|
384
|
+
| lineItem | <code>LineItemDefault</code> | lineItem record |
|
|
385
|
+
| lineItem.Id | <code>string</code> | at least Id is required to identify record |
|
|
386
|
+
| lineItem.refPath | <code>string</code> \| <code>null</code> | refpath will be used if present |
|
|
387
|
+
| product | <code>Product</code> \| <code>null</code> | |
|
|
388
|
+
|
|
389
|
+
<a name="module_LineItem.deleteLineItemById"></a>
|
|
390
|
+
|
|
391
|
+
### LineItem.deleteLineItemById(lineItem, product) ⇒ <code>Promise.<void></code>
|
|
392
|
+
**Kind**: static method of [<code>LineItem</code>](#module_LineItem)
|
|
393
|
+
|
|
394
|
+
| Param | Type | Description |
|
|
395
|
+
| --- | --- | --- |
|
|
396
|
+
| lineItem | <code>LineItemDefault</code> | minimal record of lineItem in question |
|
|
397
|
+
| lineItem.Id | <code>string</code> | record Id of account |
|
|
398
|
+
| product | <code>Product</code> | minimal record of product this lineItem belongs to |
|
|
399
|
+
| product.refPath | <code>string</code> | required as a minimum |
|
|
400
|
+
|
|
401
|
+
<a name="module_LineItem.knownLineItem"></a>
|
|
402
|
+
|
|
403
|
+
### LineItem.knownLineItem(Id, product) ⇒ <code>Promise.boolean</code>
|
|
404
|
+
Checks if this is a known LineItem Id
|
|
405
|
+
|
|
406
|
+
**Kind**: static method of [<code>LineItem</code>](#module_LineItem)
|
|
407
|
+
**Returns**: <code>Promise.boolean</code> - true is this Id is in database
|
|
408
|
+
|
|
409
|
+
| Param | Type | Description |
|
|
410
|
+
| --- | --- | --- |
|
|
411
|
+
| Id | <code>string</code> | Id value to check |
|
|
412
|
+
| product | <code>Product</code> | minimal record of product this lineItem belongs to |
|
|
413
|
+
|
|
414
|
+
<a name="module_LineItem.fetchLineItems"></a>
|
|
415
|
+
|
|
416
|
+
### LineItem.fetchLineItems() ⇒ <code>Array.LineItem</code>
|
|
417
|
+
Fetches ALL LineItem records. Not very useful
|
|
418
|
+
|
|
419
|
+
**Kind**: static method of [<code>LineItem</code>](#module_LineItem)
|
|
420
|
+
<a name="module_LineItem.fetchProductLineItems"></a>
|
|
421
|
+
|
|
422
|
+
### LineItem.fetchProductLineItems(product, stage) ⇒ <code>Array.LineItem</code>
|
|
423
|
+
Fetches ALL LineItem records for a specific product. Not very useful
|
|
424
|
+
|
|
425
|
+
**Kind**: static method of [<code>LineItem</code>](#module_LineItem)
|
|
426
|
+
|
|
427
|
+
| Param | Type | Description |
|
|
428
|
+
| --- | --- | --- |
|
|
429
|
+
| product | <code>Product</code> | minimal record of product this lineItem belongs to |
|
|
430
|
+
| stage | <code>Stage</code> | optional stage selection, to get a subset of the line items |
|
|
431
|
+
|
|
432
|
+
<a name="module_LineItem.paginateProductLineItems"></a>
|
|
433
|
+
|
|
434
|
+
### LineItem.paginateProductLineItems(product, stage, limit) ⇒ <code>PaginatedFetch</code>
|
|
435
|
+
Fetchs an object to fetch pages of lineItem data, ascending by name, "limit" at a time
|
|
436
|
+
NOT a "listener"
|
|
437
|
+
|
|
438
|
+
**Kind**: static method of [<code>LineItem</code>](#module_LineItem)
|
|
439
|
+
**Returns**: <code>PaginatedFetch</code> - object with pagination methods
|
|
440
|
+
|
|
441
|
+
| Param | Type | Description |
|
|
442
|
+
| --- | --- | --- |
|
|
443
|
+
| product | <code>Product</code> | |
|
|
444
|
+
| stage | <code>Stage</code> | optional stage selection, to get a subset of the line items |
|
|
445
|
+
| limit | <code>number</code> | |
|
|
446
|
+
|
|
447
|
+
<a name="module_LineItem.fetchLineItem"></a>
|
|
448
|
+
|
|
449
|
+
### LineItem.fetchLineItem(lineItemId, product) ⇒ <code>Promise.LineItem</code>
|
|
450
|
+
Fetches a single LineItem record by Id
|
|
451
|
+
|
|
452
|
+
**Kind**: static method of [<code>LineItem</code>](#module_LineItem)
|
|
453
|
+
|
|
454
|
+
| Param | Type | Description |
|
|
455
|
+
| --- | --- | --- |
|
|
456
|
+
| lineItemId | <code>string</code> | |
|
|
457
|
+
| product | <code>Product</code> | minimal record of product this lineItem belongs to |
|
|
458
|
+
|
|
459
|
+
<a name="module_LineItem.fetchLineItemName"></a>
|
|
460
|
+
|
|
461
|
+
### LineItem.fetchLineItemName(lineItemId, product) ⇒ <code>Promise.string</code>
|
|
462
|
+
Fetches and returns the summarized name from a LineItem record
|
|
463
|
+
|
|
464
|
+
**Kind**: static method of [<code>LineItem</code>](#module_LineItem)
|
|
465
|
+
**Returns**: <code>Promise.string</code> - the summarized name from the record
|
|
466
|
+
|
|
467
|
+
| Param | Type | Description |
|
|
468
|
+
| --- | --- | --- |
|
|
469
|
+
| lineItemId | <code>string</code> | |
|
|
470
|
+
| product | <code>Product</code> | minimal record of product this lineItem belongs to |
|
|
471
|
+
|
|
472
|
+
<a name="module_LineItem..LineItemDefault"></a>
|
|
473
|
+
|
|
474
|
+
### LineItem~LineItemDefault : <code>LineItem</code>
|
|
475
|
+
Default/Blank Form for LineItem data records
|
|
476
|
+
|
|
477
|
+
**Kind**: inner constant of [<code>LineItem</code>](#module_LineItem)
|
|
478
|
+
**Default**: <code>{"Id":null,"refPath":null,"STAGE":null,"MATERIAL":null,"commodity":null,"description":null,"unit":null,"rate":0,"count":0,"image":null}</code>
|
|
479
|
+
**Read only**: true
|
|
480
|
+
<a name="module_LineItem..LineItemData"></a>
|
|
481
|
+
|
|
482
|
+
### LineItem~LineItemData : <code>LineItem</code>
|
|
483
|
+
Form for generating placeholder LineItem data.
|
|
484
|
+
|
|
485
|
+
**Kind**: inner constant of [<code>LineItem</code>](#module_LineItem)
|
|
486
|
+
**Default**: <code>{"Id":"","refPath":null,"STAGE":"","MATERIAL":"","commodity":"","description":"","count":"","unit":"","rate":"","line_total":"","image":null}</code>
|
|
487
|
+
**Read only**: true
|
|
488
|
+
<a name="module_LineItem..LineItemDefaultForm"></a>
|
|
489
|
+
|
|
490
|
+
### LineItem~LineItemDefaultForm : <code>LineItem</code>
|
|
491
|
+
Form for driving an Editor form for LineItem Data
|
|
492
|
+
|
|
493
|
+
**Kind**: inner constant of [<code>LineItem</code>](#module_LineItem)
|
|
494
|
+
**Default**: <code>{"STAGE":"","MATERIAL":"","commodity":"","description":"","count":"","unit":"","rate":"","line_total":"","image":""}</code>
|
|
495
|
+
**Read only**: true
|
|
496
|
+
<a name="module_LineItem..updateLineItem"></a>
|
|
497
|
+
|
|
498
|
+
### LineItem~updateLineItem(lineItem, product) ⇒ <code>promise.LineItem</code>
|
|
499
|
+
writes record back to database. Assumes only Id is valid
|
|
500
|
+
|
|
501
|
+
**Kind**: inner method of [<code>LineItem</code>](#module_LineItem)
|
|
502
|
+
**Returns**: <code>promise.LineItem</code> - a copy of the data written
|
|
503
|
+
|
|
504
|
+
| Param | Type | Default | Description |
|
|
505
|
+
| --- | --- | --- | --- |
|
|
506
|
+
| lineItem | <code>LineItem</code> | | a partially-populated lineItem record for updates |
|
|
507
|
+
| product | <code>Product</code> | <code></code> | minimal record of product this lineItem belongs to |
|
|
508
|
+
|
|
509
|
+
<a name="module_LineItem..summarizeLineItem"></a>
|
|
510
|
+
|
|
511
|
+
### LineItem~summarizeLineItem(lineItem) ⇒ <code>string</code>
|
|
512
|
+
Returns a standardized formatted name string
|
|
513
|
+
|
|
514
|
+
**Kind**: inner method of [<code>LineItem</code>](#module_LineItem)
|
|
515
|
+
**Returns**: <code>string</code> - formatted name string
|
|
516
|
+
|
|
517
|
+
| Param | Type |
|
|
518
|
+
| --- | --- |
|
|
519
|
+
| lineItem | <code>LineItem</code> |
|
|
520
|
+
|
|
521
|
+
<a name="module_LineItem..lineItem_lineSum"></a>
|
|
522
|
+
|
|
523
|
+
### LineItem~lineItem\_lineSum(lineItem) ⇒ <code>number</code>
|
|
524
|
+
Calculates the lineSum (total) for a lineItem
|
|
525
|
+
|
|
526
|
+
**Kind**: inner method of [<code>LineItem</code>](#module_LineItem)
|
|
527
|
+
|
|
528
|
+
| Param | Type |
|
|
529
|
+
| --- | --- |
|
|
530
|
+
| lineItem | <code>object</code> |
|
|
531
|
+
| lineItem.rate | <code>number</code> |
|
|
532
|
+
| lineItem.count | <code>number</code> |
|
|
533
|
+
|
|
534
|
+
<a name="module_LineItem..UpdateChange"></a>
|
|
535
|
+
|
|
536
|
+
### LineItem~UpdateChange(prev, value, itemFor, fullChoiceObject) ⇒ <code>object</code>
|
|
537
|
+
checks for cross-dependencies - in this case, adjusting the "count" if the UNIT changes
|
|
538
|
+
|
|
539
|
+
**Kind**: inner method of [<code>LineItem</code>](#module_LineItem)
|
|
540
|
+
|
|
541
|
+
| Param | Type |
|
|
542
|
+
| --- | --- |
|
|
543
|
+
| prev | <code>object</code> |
|
|
544
|
+
| value | <code>object</code> |
|
|
545
|
+
| itemFor | <code>string</code> |
|
|
546
|
+
| fullChoiceObject | <code>object</code> |
|
|
547
|
+
|
|
548
|
+
<a name="module_LineItem..LineItem"></a>
|
|
549
|
+
|
|
550
|
+
### LineItem~LineItem : <code>object</code>
|
|
551
|
+
a record
|
|
552
|
+
|
|
553
|
+
**Kind**: inner typedef of [<code>LineItem</code>](#module_LineItem)
|
|
554
|
+
**Properties**
|
|
555
|
+
|
|
556
|
+
| Name | Type | Description |
|
|
557
|
+
| --- | --- | --- |
|
|
558
|
+
| Id | <code>string</code> | Id of document (redundant for convenience) |
|
|
559
|
+
| refPath | <code>string</code> | if from database, full path to document |
|
|
560
|
+
| STAGE | <code>StageLevels</code> | "fabrication", "wholesale", "retail" or other to be defined |
|
|
561
|
+
| MATERIAL | <code>MaterialLevels</code> | "base", "highValue", "service" or other value to be defined |
|
|
562
|
+
| commodity | <code>null</code> \| <code>string</code> | Id of a commodity item/material (optional) |
|
|
563
|
+
| description | <code>string</code> \| <code>null</code> | description, e.g. "Wire, Silver, Sterling, 20ga" //can be overwritten by commodity |
|
|
564
|
+
| unit | <code>string</code> \| <code>null</code> | usage/measurement unit (for unit conversion) //can be overwritten by commodity |
|
|
565
|
+
| rate | <code>number</code> | the per unit cost of this lineItem //can be overwritten by commodity |
|
|
566
|
+
| amount | <code>number</code> | amount of material/item useed |
|
|
567
|
+
| timestamp | <code>datetime</code> | initial time of creation for sorting |
|
|
568
|
+
| image | <code>url</code> \| <code>null</code> | a reference image for the lineItem |
|
|
569
|
+
|
|
570
|
+
<a name="module_LineItem..PaginatedFetch"></a>
|
|
571
|
+
|
|
572
|
+
### LineItem~PaginatedFetch : <code>object</code>
|
|
573
|
+
An object to allow for paginating a table read from Firestore. REQUIRES a sorting choice
|
|
574
|
+
|
|
575
|
+
**Kind**: inner typedef of [<code>LineItem</code>](#module_LineItem)
|
|
576
|
+
**Properties**
|
|
577
|
+
|
|
578
|
+
| Name | Type | Description |
|
|
579
|
+
| --- | --- | --- |
|
|
580
|
+
| Query | <code>Query</code> | that forms basis for the table read |
|
|
581
|
+
| limit | <code>number</code> | page size |
|
|
582
|
+
| snapshot | <code>QuerySnapshot</code> | last successful snapshot/page fetched |
|
|
583
|
+
| status | <code>enum</code> | status of pagination object |
|
|
584
|
+
| PageForward | <code>method</code> | pages the fetch forward |
|
|
585
|
+
| PageBack | <code>method</code> | pages the fetch backward |
|
|
586
|
+
|
|
587
|
+
<a name="module_Markups"></a>
|
|
588
|
+
|
|
589
|
+
## Markups
|
|
590
|
+
Typedefs, constants, support functions and database operations related to product creation stages
|
|
591
|
+
users
|
|
592
|
+
|
|
593
|
+
|
|
594
|
+
* [Markups](#module_Markups)
|
|
595
|
+
* _static_
|
|
596
|
+
* [.MaterialChoices](#module_Markups.MaterialChoices)
|
|
597
|
+
* [.StageChoices](#module_Markups.StageChoices)
|
|
598
|
+
* _inner_
|
|
599
|
+
* [~MaterialDefault](#module_Markups..MaterialDefault) : <code>Material</code>
|
|
600
|
+
* [~MarkupsDefault](#module_Markups..MarkupsDefault) : <code>Markups</code>
|
|
601
|
+
* [~MaterialDefaultForm](#module_Markups..MaterialDefaultForm) : <code>Material</code>
|
|
602
|
+
* [~MarkupsDefaultForm](#module_Markups..MarkupsDefaultForm) : <code>Stage</code>
|
|
603
|
+
* [~updateMarkups(stage, parent)](#module_Markups..updateMarkups) ⇒ <code>promise.LineItem</code>
|
|
604
|
+
* [~Markups](#module_Markups..Markups) : <code>number</code>
|
|
605
|
+
|
|
606
|
+
<a name="module_Markups.MaterialChoices"></a>
|
|
607
|
+
|
|
608
|
+
### Markups.MaterialChoices
|
|
609
|
+
**Kind**: static constant of [<code>Markups</code>](#module_Markups)
|
|
610
|
+
**Read only**: true
|
|
611
|
+
<a name="module_Markups.StageChoices"></a>
|
|
612
|
+
|
|
613
|
+
### Markups.StageChoices
|
|
614
|
+
**Kind**: static constant of [<code>Markups</code>](#module_Markups)
|
|
615
|
+
**Read only**: true
|
|
616
|
+
<a name="module_Markups..MaterialDefault"></a>
|
|
617
|
+
|
|
618
|
+
### Markups~MaterialDefault : <code>Material</code>
|
|
619
|
+
**Kind**: inner constant of [<code>Markups</code>](#module_Markups)
|
|
620
|
+
**Default**: <code>{"BASE":1,"HIGHVALUE":1,"SERVICE":1}</code>
|
|
621
|
+
**Read only**: true
|
|
622
|
+
<a name="module_Markups..MarkupsDefault"></a>
|
|
623
|
+
|
|
624
|
+
### Markups~MarkupsDefault : <code>Markups</code>
|
|
625
|
+
**Kind**: inner constant of [<code>Markups</code>](#module_Markups)
|
|
626
|
+
**Default**: <code>{"FABRICATION":"","WHOLESALE":"","RETAIL":""}</code>
|
|
627
|
+
**Read only**: true
|
|
628
|
+
<a name="module_Markups..MaterialDefaultForm"></a>
|
|
629
|
+
|
|
630
|
+
### Markups~MaterialDefaultForm : <code>Material</code>
|
|
631
|
+
**Kind**: inner constant of [<code>Markups</code>](#module_Markups)
|
|
632
|
+
**Default**: <code>{"BASE":"number","HIGHVALUE":"number","SERVICE":"number"}</code>
|
|
633
|
+
**Read only**: true
|
|
634
|
+
<a name="module_Markups..MarkupsDefaultForm"></a>
|
|
635
|
+
|
|
636
|
+
### Markups~MarkupsDefaultForm : <code>Stage</code>
|
|
637
|
+
**Kind**: inner constant of [<code>Markups</code>](#module_Markups)
|
|
638
|
+
**Default**: <code>{"FABRICATION":"","WHOLESALE":"","RETAIL":""}</code>
|
|
639
|
+
**Read only**: true
|
|
640
|
+
<a name="module_Markups..updateMarkups"></a>
|
|
641
|
+
|
|
642
|
+
### Markups~updateMarkups(stage, parent) ⇒ <code>promise.LineItem</code>
|
|
643
|
+
writes record back to database. Assumes only Id is valid
|
|
644
|
+
|
|
645
|
+
**Kind**: inner method of [<code>Markups</code>](#module_Markups)
|
|
646
|
+
**Returns**: <code>promise.LineItem</code> - a copy of the data written
|
|
647
|
+
|
|
648
|
+
| Param | Type | Description |
|
|
649
|
+
| --- | --- | --- |
|
|
650
|
+
| stage | <code>LineItem</code> | a partially-populated product record for updates |
|
|
651
|
+
| parent | <code>Record</code> | minimal record of product, user (or none) this stage belongs to |
|
|
652
|
+
|
|
653
|
+
<a name="module_Markups..Markups"></a>
|
|
654
|
+
|
|
655
|
+
### Markups~Markups : <code>number</code>
|
|
656
|
+
**Kind**: inner typedef of [<code>Markups</code>](#module_Markups)
|
|
657
|
+
<a name="module_Payment"></a>
|
|
658
|
+
|
|
659
|
+
## Payment
|
|
660
|
+
"Payment Descriptor" handling operations. These descriptors represent paymentMethods, each tied
|
|
661
|
+
to an individual user. These do not *particularly* represent a paymentProvider - they are meant
|
|
662
|
+
as an abstraction above a specific payment processor.
|
|
663
|
+
|
|
664
|
+
|
|
665
|
+
* [Payment](#module_Payment)
|
|
666
|
+
* _static_
|
|
667
|
+
* [.ERROR_TYPES](#module_Payment.ERROR_TYPES) : <code>Object</code>
|
|
668
|
+
* [.PaymentDefault](#module_Payment.PaymentDefault) : <code>PaymentData</code>
|
|
669
|
+
* [.paymentDescriptor](#module_Payment.paymentDescriptor) : <code>PaymentDescriptorType</code>
|
|
670
|
+
* [.receiptDefault](#module_Payment.receiptDefault) : <code>ReceiptType</code>
|
|
671
|
+
* [.createPaymentRecord(account, batch)](#module_Payment.createPaymentRecord) ⇒ <code>Promise.<(WriteBatch\|Transaction\|void)></code>
|
|
672
|
+
* [.savePaymentData(paymentData)](#module_Payment.savePaymentData)
|
|
673
|
+
* [.fetchPayment(account, paymentData)](#module_Payment.fetchPayment)
|
|
674
|
+
* [.fetchPaymentByUser(accountId, type, paymentData)](#module_Payment.fetchPaymentByUser)
|
|
675
|
+
* [.addPaymentDescriptor(account, descriptor, batch)](#module_Payment.addPaymentDescriptor) ⇒ <code>Promise.PaymentDescriptorType</code>
|
|
676
|
+
* [.savePaymentDescriptor(descriptor)](#module_Payment.savePaymentDescriptor) ⇒ <code>Promise.PaymentDescriptorType</code>
|
|
677
|
+
* [.removePaymentDescriptor(account, descriptor)](#module_Payment.removePaymentDescriptor) ⇒ <code>Promise.<void></code>
|
|
678
|
+
* [.fetchPaymentDescriptors(account)](#module_Payment.fetchPaymentDescriptors) ⇒ <code>Promise.Array.PaymentDescriptor</code>
|
|
679
|
+
* [.listPDSummaries(account)](#module_Payment.listPDSummaries) ⇒ <code>Promise.Array.PDSummary</code>
|
|
680
|
+
* [.fetchLatestPDSummary(account)](#module_Payment.fetchLatestPDSummary) ⇒ <code>Promise.PaymentDescriptorType</code>
|
|
681
|
+
* [.fetchPDByFingerprint(account, fingerprint)](#module_Payment.fetchPDByFingerprint) ⇒ <code>Promise.<PDSummary></code>
|
|
682
|
+
* [.fetchPDByOwnerType(accountId, type, fingerprint)](#module_Payment.fetchPDByOwnerType) ⇒ <code>Promise.<PDSummary></code>
|
|
683
|
+
* [.replaceDefaultPDSummary(account, PDSummary)](#module_Payment.replaceDefaultPDSummary) ⇒ <code>Promise.AccountObject</code>
|
|
684
|
+
* [.saveReceiptRecord(account, receipt, batch)](#module_Payment.saveReceiptRecord) ⇒ <code>Promise.ReceiptType</code>
|
|
685
|
+
* [.updateReceipt(receipt)](#module_Payment.updateReceipt) ⇒ <code>Promise.ReceiptType</code>
|
|
686
|
+
* [.saveReceiptRecordByOwnerType(ownerId, type, receipt, batch)](#module_Payment.saveReceiptRecordByOwnerType) ⇒ <code>Promise.ReceiptType</code>
|
|
687
|
+
* [.anyReceiptsByMonthStamp(account, monthStamp)](#module_Payment.anyReceiptsByMonthStamp) ⇒ <code>Promise.Array.ReceiptType</code>
|
|
688
|
+
* [.saveReceiptRecordByChild(child, receipt, batch)](#module_Payment.saveReceiptRecordByChild) ⇒ <code>Promise.ReceiptType</code>
|
|
689
|
+
* [.fetchReceiptsFiltered(account, filterArray, sortArray, limit)](#module_Payment.fetchReceiptsFiltered) ⇒ <code>Promise.Array.ReceiptType</code>
|
|
690
|
+
* [.fetchProblemReceipts(account)](#module_Payment.fetchProblemReceipts) ⇒ <code>Promise.Array.ReceiptType</code>
|
|
691
|
+
* [.fetchPledgeTicketReceipt(pledgeTicket)](#module_Payment.fetchPledgeTicketReceipt) ⇒ <code>Promise.ReceiptType</code>
|
|
692
|
+
* [.markReceiptFromPledgeTicket(pledgeTicket, label)](#module_Payment.markReceiptFromPledgeTicket) ⇒ <code>Promise.ReceiptType</code>
|
|
693
|
+
* [.markReceipt(receipt, label)](#module_Payment.markReceipt) ⇒ <code>Promise.ReceiptType</code>
|
|
694
|
+
* _inner_
|
|
695
|
+
* [~fetchReceipt(account, receiptId)](#module_Payment..fetchReceipt) ⇒ <code>Promise.ReceiptType</code>
|
|
696
|
+
* [~PaymentData](#module_Payment..PaymentData) : <code>object</code>
|
|
697
|
+
* [~PaymentDescriptorType](#module_Payment..PaymentDescriptorType) : <code>object</code>
|
|
698
|
+
* [~PDSummary](#module_Payment..PDSummary) : <code>object</code>
|
|
699
|
+
* [~ReceiptType](#module_Payment..ReceiptType) : <code>object</code>
|
|
700
|
+
* [~AccountObject](#module_Payment..AccountObject) : <code>UserObject</code>
|
|
701
|
+
|
|
702
|
+
<a name="module_Payment.ERROR_TYPES"></a>
|
|
703
|
+
|
|
704
|
+
### Payment.ERROR\_TYPES : <code>Object</code>
|
|
705
|
+
**Kind**: static constant of [<code>Payment</code>](#module_Payment)
|
|
706
|
+
<a name="module_Payment.PaymentDefault"></a>
|
|
707
|
+
|
|
708
|
+
### Payment.PaymentDefault : <code>PaymentData</code>
|
|
709
|
+
**Kind**: static constant of [<code>Payment</code>](#module_Payment)
|
|
710
|
+
<a name="module_Payment.paymentDescriptor"></a>
|
|
711
|
+
|
|
712
|
+
### Payment.paymentDescriptor : <code>PaymentDescriptorType</code>
|
|
713
|
+
**Kind**: static constant of [<code>Payment</code>](#module_Payment)
|
|
714
|
+
<a name="module_Payment.receiptDefault"></a>
|
|
715
|
+
|
|
716
|
+
### Payment.receiptDefault : <code>ReceiptType</code>
|
|
717
|
+
**Kind**: static constant of [<code>Payment</code>](#module_Payment)
|
|
718
|
+
<a name="module_Payment.createPaymentRecord"></a>
|
|
719
|
+
|
|
720
|
+
### Payment.createPaymentRecord(account, batch) ⇒ <code>Promise.<(WriteBatch\|Transaction\|void)></code>
|
|
721
|
+
Creates the Organization Payment information document
|
|
722
|
+
|
|
723
|
+
**Kind**: static method of [<code>Payment</code>](#module_Payment)
|
|
724
|
+
**Returns**: <code>Promise.<(WriteBatch\|Transaction\|void)></code> - WriteBatch, Transaction or Void
|
|
725
|
+
|
|
726
|
+
| Param | Type | Description |
|
|
727
|
+
| --- | --- | --- |
|
|
728
|
+
| account | <code>AccountObject</code> | |
|
|
729
|
+
| batch | <code>WriteBatch</code> \| <code>Transaction</code> | batching object. Transaction will be added to the batch |
|
|
730
|
+
|
|
731
|
+
<a name="module_Payment.savePaymentData"></a>
|
|
732
|
+
|
|
733
|
+
### Payment.savePaymentData(paymentData)
|
|
734
|
+
Saves a payment data record to a given account (user)
|
|
735
|
+
ALL OF fans, artists and venues save the payment data in the same collection
|
|
736
|
+
name under the parent, with the SAME Id as the parent
|
|
737
|
+
PaymentData *COMES FROM* payement processor, and should INCLUDE the record Id and
|
|
738
|
+
refPath
|
|
739
|
+
|
|
740
|
+
**Kind**: static method of [<code>Payment</code>](#module_Payment)
|
|
741
|
+
|
|
742
|
+
| Param | Type |
|
|
743
|
+
| --- | --- |
|
|
744
|
+
| paymentData | <code>PaymentDataRecord</code> |
|
|
745
|
+
|
|
746
|
+
<a name="module_Payment.fetchPayment"></a>
|
|
747
|
+
|
|
748
|
+
### Payment.fetchPayment(account, paymentData)
|
|
749
|
+
fetches a paymentData record from the database for an account
|
|
750
|
+
ALL OF fans, artists and venues, etc save the payment data in the same collection
|
|
751
|
+
name under the parent, with the SAME Id as the parent
|
|
752
|
+
|
|
753
|
+
**Kind**: static method of [<code>Payment</code>](#module_Payment)
|
|
754
|
+
|
|
755
|
+
| Param | Type |
|
|
756
|
+
| --- | --- |
|
|
757
|
+
| account | <code>AccountType</code> |
|
|
758
|
+
| paymentData | <code>Promise.PaymentData</code> |
|
|
759
|
+
|
|
760
|
+
<a name="module_Payment.fetchPaymentByUser"></a>
|
|
761
|
+
|
|
762
|
+
### Payment.fetchPaymentByUser(accountId, type, paymentData)
|
|
763
|
+
fetches a paymentData record from the database for an account when only accountID and type are known
|
|
764
|
+
ALL OF fans, artists and venues save the payment data in the same collection
|
|
765
|
+
name under the parent, with the SAME Id as the parent
|
|
766
|
+
|
|
767
|
+
**Kind**: static method of [<code>Payment</code>](#module_Payment)
|
|
768
|
+
|
|
769
|
+
| Param | Type |
|
|
770
|
+
| --- | --- |
|
|
771
|
+
| accountId | <code>string</code> |
|
|
772
|
+
| type | <code>string</code> |
|
|
773
|
+
| paymentData | <code>Promise.PaymentData</code> |
|
|
774
|
+
|
|
775
|
+
<a name="module_Payment.addPaymentDescriptor"></a>
|
|
776
|
+
|
|
777
|
+
### Payment.addPaymentDescriptor(account, descriptor, batch) ⇒ <code>Promise.PaymentDescriptorType</code>
|
|
778
|
+
Adds a specific paymentDescriptor to an account payment data
|
|
779
|
+
|
|
780
|
+
**Kind**: static method of [<code>Payment</code>](#module_Payment)
|
|
781
|
+
|
|
782
|
+
| Param | Type | Description |
|
|
783
|
+
| --- | --- | --- |
|
|
784
|
+
| account | <code>AccountType</code> | |
|
|
785
|
+
| account.Id | <code>string</code> | |
|
|
786
|
+
| account.refPath | <code>string</code> | |
|
|
787
|
+
| descriptor | <code>PaymentDescriptorType</code> | |
|
|
788
|
+
| descriptor.paymentMethod | <code>string</code> | |
|
|
789
|
+
| descriptor.fingerprint | <code>string</code> | |
|
|
790
|
+
| descriptor.label | <code>string</code> | |
|
|
791
|
+
| batch | <code>WriteBatch</code> \| <code>Transaction</code> | batching object. Transaction will be added to the batch |
|
|
792
|
+
|
|
793
|
+
<a name="module_Payment.savePaymentDescriptor"></a>
|
|
794
|
+
|
|
795
|
+
### Payment.savePaymentDescriptor(descriptor) ⇒ <code>Promise.PaymentDescriptorType</code>
|
|
796
|
+
Saves a modified paymentDescriptor back to the database
|
|
797
|
+
|
|
798
|
+
**Kind**: static method of [<code>Payment</code>](#module_Payment)
|
|
799
|
+
|
|
800
|
+
| Param | Type |
|
|
801
|
+
| --- | --- |
|
|
802
|
+
| descriptor | <code>PaymentDescriptorType</code> |
|
|
803
|
+
| descriptor.Id | <code>string</code> |
|
|
804
|
+
| descriptor.refPath | <code>string</code> |
|
|
805
|
+
|
|
806
|
+
<a name="module_Payment.removePaymentDescriptor"></a>
|
|
807
|
+
|
|
808
|
+
### Payment.removePaymentDescriptor(account, descriptor) ⇒ <code>Promise.<void></code>
|
|
809
|
+
Removes a paymentDescriptor from an account's paymentData
|
|
810
|
+
|
|
811
|
+
**Kind**: static method of [<code>Payment</code>](#module_Payment)
|
|
812
|
+
|
|
813
|
+
| Param | Type |
|
|
814
|
+
| --- | --- |
|
|
815
|
+
| account | <code>AccountType</code> |
|
|
816
|
+
| descriptor | <code>PaymentDescriptorType</code> |
|
|
817
|
+
|
|
818
|
+
<a name="module_Payment.fetchPaymentDescriptors"></a>
|
|
819
|
+
|
|
820
|
+
### Payment.fetchPaymentDescriptors(account) ⇒ <code>Promise.Array.PaymentDescriptor</code>
|
|
821
|
+
fetch all customer card records IN OUR DATABASE (not payment database)
|
|
822
|
+
|
|
823
|
+
**Kind**: static method of [<code>Payment</code>](#module_Payment)
|
|
824
|
+
|
|
825
|
+
| Param | Type |
|
|
826
|
+
| --- | --- |
|
|
827
|
+
| account | <code>AccountType</code> |
|
|
828
|
+
| account.refPath | <code>string</code> |
|
|
829
|
+
|
|
830
|
+
<a name="module_Payment.listPDSummaries"></a>
|
|
831
|
+
|
|
832
|
+
### Payment.listPDSummaries(account) ⇒ <code>Promise.Array.PDSummary</code>
|
|
833
|
+
fetch the front-end list of paymentDescriptors
|
|
834
|
+
|
|
835
|
+
**Kind**: static method of [<code>Payment</code>](#module_Payment)
|
|
836
|
+
|
|
837
|
+
| Param | Type |
|
|
838
|
+
| --- | --- |
|
|
839
|
+
| account | <code>AccountType</code> |
|
|
840
|
+
| account.Id | <code>string</code> |
|
|
841
|
+
| account.refPath | <code>string</code> |
|
|
842
|
+
|
|
843
|
+
<a name="module_Payment.fetchLatestPDSummary"></a>
|
|
844
|
+
|
|
845
|
+
### Payment.fetchLatestPDSummary(account) ⇒ <code>Promise.PaymentDescriptorType</code>
|
|
846
|
+
**Kind**: static method of [<code>Payment</code>](#module_Payment)
|
|
847
|
+
|
|
848
|
+
| Param | Type |
|
|
849
|
+
| --- | --- |
|
|
850
|
+
| account | <code>AccountType</code> |
|
|
851
|
+
| account.Id | <code>string</code> |
|
|
852
|
+
| account.refPath | <code>string</code> |
|
|
853
|
+
|
|
854
|
+
<a name="module_Payment.fetchPDByFingerprint"></a>
|
|
855
|
+
|
|
856
|
+
### Payment.fetchPDByFingerprint(account, fingerprint) ⇒ <code>Promise.<PDSummary></code>
|
|
857
|
+
retreives a PD, given the account Id and Type
|
|
858
|
+
|
|
859
|
+
**Kind**: static method of [<code>Payment</code>](#module_Payment)
|
|
860
|
+
|
|
861
|
+
| Param | Type |
|
|
862
|
+
| --- | --- |
|
|
863
|
+
| account | <code>AccountType</code> |
|
|
864
|
+
| fingerprint | <code>string</code> |
|
|
865
|
+
|
|
866
|
+
<a name="module_Payment.fetchPDByOwnerType"></a>
|
|
867
|
+
|
|
868
|
+
### Payment.fetchPDByOwnerType(accountId, type, fingerprint) ⇒ <code>Promise.<PDSummary></code>
|
|
869
|
+
retreives a PD, given the account Id and Type
|
|
870
|
+
|
|
871
|
+
**Kind**: static method of [<code>Payment</code>](#module_Payment)
|
|
872
|
+
|
|
873
|
+
| Param | Type |
|
|
874
|
+
| --- | --- |
|
|
875
|
+
| accountId | <code>string</code> |
|
|
876
|
+
| type | <code>string</code> |
|
|
877
|
+
| fingerprint | <code>string</code> |
|
|
878
|
+
|
|
879
|
+
<a name="module_Payment.replaceDefaultPDSummary"></a>
|
|
880
|
+
|
|
881
|
+
### Payment.replaceDefaultPDSummary(account, PDSummary) ⇒ <code>Promise.AccountObject</code>
|
|
882
|
+
Copies a PDSummary tobe the new default (convenience function)
|
|
883
|
+
|
|
884
|
+
**Kind**: static method of [<code>Payment</code>](#module_Payment)
|
|
885
|
+
|
|
886
|
+
| Param | Type |
|
|
887
|
+
| --- | --- |
|
|
888
|
+
| account | <code>AccountType</code> |
|
|
889
|
+
| PDSummary | <code>PDSummary</code> |
|
|
890
|
+
|
|
891
|
+
<a name="module_Payment.saveReceiptRecord"></a>
|
|
892
|
+
|
|
893
|
+
### Payment.saveReceiptRecord(account, receipt, batch) ⇒ <code>Promise.ReceiptType</code>
|
|
894
|
+
Savess a Receipt to an account
|
|
895
|
+
|
|
896
|
+
**Kind**: static method of [<code>Payment</code>](#module_Payment)
|
|
897
|
+
|
|
898
|
+
| Param | Type | Description |
|
|
899
|
+
| --- | --- | --- |
|
|
900
|
+
| account | <code>AccountType</code> | |
|
|
901
|
+
| receipt | <code>ReceiptType</code> | |
|
|
902
|
+
| batch | <code>WriteBatch</code> \| <code>Transaction</code> | batching object. Transaction will be added to the batch |
|
|
903
|
+
|
|
904
|
+
<a name="module_Payment.updateReceipt"></a>
|
|
905
|
+
|
|
906
|
+
### Payment.updateReceipt(receipt) ⇒ <code>Promise.ReceiptType</code>
|
|
907
|
+
Updates a (changed?) Receipt record
|
|
908
|
+
|
|
909
|
+
**Kind**: static method of [<code>Payment</code>](#module_Payment)
|
|
910
|
+
|
|
911
|
+
| Param | Type |
|
|
912
|
+
| --- | --- |
|
|
913
|
+
| receipt | <code>ReceiptType</code> |
|
|
914
|
+
|
|
915
|
+
<a name="module_Payment.saveReceiptRecordByOwnerType"></a>
|
|
916
|
+
|
|
917
|
+
### Payment.saveReceiptRecordByOwnerType(ownerId, type, receipt, batch) ⇒ <code>Promise.ReceiptType</code>
|
|
918
|
+
Saves a new receipt to an account referrred by ID and type
|
|
919
|
+
|
|
920
|
+
**Kind**: static method of [<code>Payment</code>](#module_Payment)
|
|
921
|
+
|
|
922
|
+
| Param | Type | Description |
|
|
923
|
+
| --- | --- | --- |
|
|
924
|
+
| ownerId | <code>string</code> | |
|
|
925
|
+
| type | <code>string</code> | either ORGANIZATIONS or USER |
|
|
926
|
+
| receipt | <code>ReceiptType</code> | |
|
|
927
|
+
| batch | <code>WriteBatch</code> \| <code>Transaction</code> | batching object. Transaction will be added to the batch |
|
|
928
|
+
|
|
929
|
+
<a name="module_Payment.anyReceiptsByMonthStamp"></a>
|
|
930
|
+
|
|
931
|
+
### Payment.anyReceiptsByMonthStamp(account, monthStamp) ⇒ <code>Promise.Array.ReceiptType</code>
|
|
932
|
+
Fetches an array of receipts in any particular month by monthStampt
|
|
933
|
+
|
|
934
|
+
**Kind**: static method of [<code>Payment</code>](#module_Payment)
|
|
935
|
+
|
|
936
|
+
| Param | Type |
|
|
937
|
+
| --- | --- |
|
|
938
|
+
| account | <code>AccountObject</code> |
|
|
939
|
+
| monthStamp | <code>dateString</code> |
|
|
940
|
+
|
|
941
|
+
<a name="module_Payment.saveReceiptRecordByChild"></a>
|
|
942
|
+
|
|
943
|
+
### Payment.saveReceiptRecordByChild(child, receipt, batch) ⇒ <code>Promise.ReceiptType</code>
|
|
944
|
+
Saves a receipt by a child record reference
|
|
945
|
+
|
|
946
|
+
**Kind**: static method of [<code>Payment</code>](#module_Payment)
|
|
947
|
+
|
|
948
|
+
| Param | Type | Description |
|
|
949
|
+
| --- | --- | --- |
|
|
950
|
+
| child | <code>RecordDocument</code> | |
|
|
951
|
+
| receipt | <code>ReceiptType</code> | |
|
|
952
|
+
| batch | <code>WriteBatch</code> \| <code>Transaction</code> | batching object. Transaction will be added to the batch |
|
|
953
|
+
|
|
954
|
+
<a name="module_Payment.fetchReceiptsFiltered"></a>
|
|
955
|
+
|
|
956
|
+
### Payment.fetchReceiptsFiltered(account, filterArray, sortArray, limit) ⇒ <code>Promise.Array.ReceiptType</code>
|
|
957
|
+
Fetches receipts based on a filter set
|
|
958
|
+
|
|
959
|
+
**Kind**: static method of [<code>Payment</code>](#module_Payment)
|
|
960
|
+
|
|
961
|
+
| Param | Type |
|
|
962
|
+
| --- | --- |
|
|
963
|
+
| account | <code>AccountObject</code> |
|
|
964
|
+
| account.refPath | <code>string</code> |
|
|
965
|
+
| filterArray | <code>Array.filterObject</code> |
|
|
966
|
+
| sortArray | <code>Array.sortObject</code> |
|
|
967
|
+
| limit | <code>number</code> |
|
|
968
|
+
|
|
969
|
+
<a name="module_Payment.fetchProblemReceipts"></a>
|
|
970
|
+
|
|
971
|
+
### Payment.fetchProblemReceipts(account) ⇒ <code>Promise.Array.ReceiptType</code>
|
|
972
|
+
**Kind**: static method of [<code>Payment</code>](#module_Payment)
|
|
973
|
+
|
|
974
|
+
| Param | Type |
|
|
975
|
+
| --- | --- |
|
|
976
|
+
| account | <code>AccountObject</code> |
|
|
977
|
+
| account.refPath | <code>string</code> |
|
|
978
|
+
|
|
979
|
+
<a name="module_Payment.fetchPledgeTicketReceipt"></a>
|
|
980
|
+
|
|
981
|
+
### Payment.fetchPledgeTicketReceipt(pledgeTicket) ⇒ <code>Promise.ReceiptType</code>
|
|
982
|
+
Fetches the receipt for a pledgeTicket
|
|
983
|
+
|
|
984
|
+
**Kind**: static method of [<code>Payment</code>](#module_Payment)
|
|
985
|
+
|
|
986
|
+
| Param | Type |
|
|
987
|
+
| --- | --- |
|
|
988
|
+
| pledgeTicket | <code>PledgeTicket</code> |
|
|
989
|
+
|
|
990
|
+
<a name="module_Payment.markReceiptFromPledgeTicket"></a>
|
|
991
|
+
|
|
992
|
+
### Payment.markReceiptFromPledgeTicket(pledgeTicket, label) ⇒ <code>Promise.ReceiptType</code>
|
|
993
|
+
Changes the paidQ label on a receipt associated with a pledgeTicket
|
|
994
|
+
|
|
995
|
+
**Kind**: static method of [<code>Payment</code>](#module_Payment)
|
|
996
|
+
|
|
997
|
+
| Param | Type |
|
|
998
|
+
| --- | --- |
|
|
999
|
+
| pledgeTicket | <code>pledgeTicketType</code> |
|
|
1000
|
+
| label | <code>string</code> |
|
|
1001
|
+
|
|
1002
|
+
<a name="module_Payment.markReceipt"></a>
|
|
1003
|
+
|
|
1004
|
+
### Payment.markReceipt(receipt, label) ⇒ <code>Promise.ReceiptType</code>
|
|
1005
|
+
Changes the paidQ label on a receipt associated with a pledgeTicket
|
|
1006
|
+
|
|
1007
|
+
**Kind**: static method of [<code>Payment</code>](#module_Payment)
|
|
1008
|
+
|
|
1009
|
+
| Param | Type |
|
|
1010
|
+
| --- | --- |
|
|
1011
|
+
| receipt | <code>receiptType</code> |
|
|
1012
|
+
| label | <code>string</code> |
|
|
1013
|
+
|
|
1014
|
+
<a name="module_Payment..fetchReceipt"></a>
|
|
1015
|
+
|
|
1016
|
+
### Payment~fetchReceipt(account, receiptId) ⇒ <code>Promise.ReceiptType</code>
|
|
1017
|
+
**Kind**: inner method of [<code>Payment</code>](#module_Payment)
|
|
1018
|
+
|
|
1019
|
+
| Param | Type |
|
|
1020
|
+
| --- | --- |
|
|
1021
|
+
| account | <code>AccountObject</code> |
|
|
1022
|
+
| account.refPath | <code>string</code> |
|
|
1023
|
+
| receiptId | <code>string</code> |
|
|
1024
|
+
|
|
1025
|
+
<a name="module_Payment..PaymentData"></a>
|
|
1026
|
+
|
|
1027
|
+
### Payment~PaymentData : <code>object</code>
|
|
1028
|
+
**Kind**: inner typedef of [<code>Payment</code>](#module_Payment)
|
|
1029
|
+
**Properties**
|
|
1030
|
+
|
|
1031
|
+
| Name | Type |
|
|
1032
|
+
| --- | --- |
|
|
1033
|
+
| Id | <code>string</code> |
|
|
1034
|
+
| payment_gateway | <code>string</code> |
|
|
1035
|
+
| status | <code>string</code> |
|
|
1036
|
+
|
|
1037
|
+
<a name="module_Payment..PaymentDescriptorType"></a>
|
|
1038
|
+
|
|
1039
|
+
### Payment~PaymentDescriptorType : <code>object</code>
|
|
1040
|
+
**Kind**: inner typedef of [<code>Payment</code>](#module_Payment)
|
|
1041
|
+
**Properties**
|
|
1042
|
+
|
|
1043
|
+
| Name | Type | Description |
|
|
1044
|
+
| --- | --- | --- |
|
|
1045
|
+
| Id | <code>string</code> | document Id of this Card Descriptor (same as fingerprint) |
|
|
1046
|
+
| paymentMethod | <code>string</code> | Id of payment system card item |
|
|
1047
|
+
| fingerprint | <code>string</code> | Unique hash of card info - for checking uniqueness |
|
|
1048
|
+
| label | <code>string</code> | Brand & last4, or other descriptive |
|
|
1049
|
+
| expiry | <code>string</code> | expiry date of payment method (if any) |
|
|
1050
|
+
| timestamp | <code>timestamp</code> | last create or modify server time |
|
|
1051
|
+
|
|
1052
|
+
<a name="module_Payment..PDSummary"></a>
|
|
1053
|
+
|
|
1054
|
+
### Payment~PDSummary : <code>object</code>
|
|
1055
|
+
**Kind**: inner typedef of [<code>Payment</code>](#module_Payment)
|
|
1056
|
+
**Properties**
|
|
1057
|
+
|
|
1058
|
+
| Name | Type | Description |
|
|
1059
|
+
| --- | --- | --- |
|
|
1060
|
+
| Id | <code>string</code> | document Id of this Card Descriptor |
|
|
1061
|
+
| label | <code>string</code> | Brand & last4, or other descriptive |
|
|
1062
|
+
|
|
1063
|
+
<a name="module_Payment..ReceiptType"></a>
|
|
1064
|
+
|
|
1065
|
+
### Payment~ReceiptType : <code>object</code>
|
|
1066
|
+
**Kind**: inner typedef of [<code>Payment</code>](#module_Payment)
|
|
1067
|
+
**Properties**
|
|
1068
|
+
|
|
1069
|
+
| Name | Type | Description |
|
|
1070
|
+
| --- | --- | --- |
|
|
1071
|
+
| Id | <code>string</code> | same Id as the associated pledgeTicket |
|
|
1072
|
+
| amount | <code>number</code> | |
|
|
1073
|
+
| payment | <code>object</code> | |
|
|
1074
|
+
| link | <code>string</code> | Id of associated payment_intent |
|
|
1075
|
+
| paidQ | <code>string</code> | string describing status |
|
|
1076
|
+
| description | <code>string</code> | supplemental information |
|
|
1077
|
+
|
|
1078
|
+
<a name="module_Payment..AccountObject"></a>
|
|
1079
|
+
|
|
1080
|
+
### Payment~AccountObject : <code>UserObject</code>
|
|
1081
|
+
**Kind**: inner typedef of [<code>Payment</code>](#module_Payment)
|
|
1082
|
+
<a name="module_Product"></a>
|
|
1083
|
+
|
|
1084
|
+
## Product
|
|
1085
|
+
Typedefs, constants, support functions and database operations related to Products
|
|
1086
|
+
|
|
1087
|
+
|
|
1088
|
+
* [Product](#module_Product)
|
|
1089
|
+
* _static_
|
|
1090
|
+
* [.createProduct(user)](#module_Product.createProduct) ⇒ <code>Promise.<void></code>
|
|
1091
|
+
* [.makeProductFromChild(child)](#module_Product.makeProductFromChild) ⇒ <code>Record</code>
|
|
1092
|
+
* _inner_
|
|
1093
|
+
* [~ProductDefault](#module_Product..ProductDefault) : <code>Product</code>
|
|
1094
|
+
* [~ProductDataForm](#module_Product..ProductDataForm) : <code>Product</code>
|
|
1095
|
+
* [~ProductDefaultForm](#module_Product..ProductDefaultForm) : <code>Product</code>
|
|
1096
|
+
* [~updateProduct(product, user)](#module_Product..updateProduct) ⇒ <code>promise.LineItem</code>
|
|
1097
|
+
* [~summarizeProduct(product)](#module_Product..summarizeProduct) ⇒ <code>string</code>
|
|
1098
|
+
* [~Product](#module_Product..Product) : <code>object</code>
|
|
1099
|
+
|
|
1100
|
+
<a name="module_Product.createProduct"></a>
|
|
1101
|
+
|
|
1102
|
+
### Product.createProduct(user) ⇒ <code>Promise.<void></code>
|
|
1103
|
+
Creates a new Blank Product
|
|
1104
|
+
|
|
1105
|
+
**Kind**: static method of [<code>Product</code>](#module_Product)
|
|
1106
|
+
|
|
1107
|
+
| Param | Type | Description |
|
|
1108
|
+
| --- | --- | --- |
|
|
1109
|
+
| user | <code>UserObject</code> | minimal record of user this commodity belongs to (if any) |
|
|
1110
|
+
|
|
1111
|
+
<a name="module_Product.makeProductFromChild"></a>
|
|
1112
|
+
|
|
1113
|
+
### Product.makeProductFromChild(child) ⇒ <code>Record</code>
|
|
1114
|
+
**Kind**: static method of [<code>Product</code>](#module_Product)
|
|
1115
|
+
|
|
1116
|
+
| Param | Type | Description |
|
|
1117
|
+
| --- | --- | --- |
|
|
1118
|
+
| child | <code>Record</code> | a record assumed to be a leaf/child |
|
|
1119
|
+
|
|
1120
|
+
<a name="module_Product..ProductDefault"></a>
|
|
1121
|
+
|
|
1122
|
+
### Product~ProductDefault : <code>Product</code>
|
|
1123
|
+
**Kind**: inner constant of [<code>Product</code>](#module_Product)
|
|
1124
|
+
**Default**: <code>{"Id":null,"refPath":null,"name":"","description":null,"sku":null,"markups":null,"projectQ":false,"created":null,"modified":null}</code>
|
|
1125
|
+
**Read only**: true
|
|
1126
|
+
<a name="module_Product..ProductDataForm"></a>
|
|
1127
|
+
|
|
1128
|
+
### Product~ProductDataForm : <code>Product</code>
|
|
1129
|
+
**Kind**: inner constant of [<code>Product</code>](#module_Product)
|
|
1130
|
+
**Default**: <code>{"Id":"","refPath":null,"name":"","description":"","sku":"","markups":"","projectQ":""}</code>
|
|
1131
|
+
**Read only**: true
|
|
1132
|
+
<a name="module_Product..ProductDefaultForm"></a>
|
|
1133
|
+
|
|
1134
|
+
### Product~ProductDefaultForm : <code>Product</code>
|
|
1135
|
+
**Kind**: inner constant of [<code>Product</code>](#module_Product)
|
|
1136
|
+
**Default**: <code>{"Id":"","refPath":"","name":"text","description":"textarea","sku":"text","markups":"","projectQ":""}</code>
|
|
1137
|
+
**Read only**: true
|
|
1138
|
+
<a name="module_Product..updateProduct"></a>
|
|
1139
|
+
|
|
1140
|
+
### Product~updateProduct(product, user) ⇒ <code>promise.LineItem</code>
|
|
1141
|
+
writes record back to database. Assumes only Id is valid
|
|
1142
|
+
|
|
1143
|
+
**Kind**: inner method of [<code>Product</code>](#module_Product)
|
|
1144
|
+
**Returns**: <code>promise.LineItem</code> - a copy of the data written
|
|
1145
|
+
|
|
1146
|
+
| Param | Type | Default | Description |
|
|
1147
|
+
| --- | --- | --- | --- |
|
|
1148
|
+
| product | <code>LineItem</code> | | a partially-populated product record for updates |
|
|
1149
|
+
| user | <code>Product</code> | <code></code> | minimal record of user this product belongs to |
|
|
1150
|
+
|
|
1151
|
+
<a name="module_Product..summarizeProduct"></a>
|
|
1152
|
+
|
|
1153
|
+
### Product~summarizeProduct(product) ⇒ <code>string</code>
|
|
1154
|
+
Returns a standardized formatted name string
|
|
1155
|
+
|
|
1156
|
+
**Kind**: inner method of [<code>Product</code>](#module_Product)
|
|
1157
|
+
**Returns**: <code>string</code> - formatted name string
|
|
1158
|
+
|
|
1159
|
+
| Param | Type |
|
|
1160
|
+
| --- | --- |
|
|
1161
|
+
| product | <code>Unit</code> |
|
|
1162
|
+
|
|
1163
|
+
<a name="module_Product..Product"></a>
|
|
1164
|
+
|
|
1165
|
+
### Product~Product : <code>object</code>
|
|
1166
|
+
a record
|
|
1167
|
+
|
|
1168
|
+
**Kind**: inner typedef of [<code>Product</code>](#module_Product)
|
|
1169
|
+
**Properties**
|
|
1170
|
+
|
|
1171
|
+
| Name | Type | Description |
|
|
1172
|
+
| --- | --- | --- |
|
|
1173
|
+
| Id | <code>string</code> | Id of document (redundant for convenience) |
|
|
1174
|
+
| refPath | <code>string</code> | if from database, full path to document |
|
|
1175
|
+
| name | <code>string</code> | name for the Product |
|
|
1176
|
+
| description | <code>string</code> | |
|
|
1177
|
+
| sku | <code>string</code> | |
|
|
1178
|
+
| markups | <code>module:Markups~Stage</code> | |
|
|
1179
|
+
| projectQ | <code>boolean</code> | flag for product/project |
|
|
1180
|
+
| created | <code>dateTime</code> | |
|
|
1181
|
+
| modified | <code>dateTime</code> | |
|
|
1182
|
+
|
|
1183
|
+
<a name="module_Units"></a>
|
|
1184
|
+
|
|
1185
|
+
## Units
|
|
1186
|
+
Typedefs, constants, support functions and database operations related to usage Units
|
|
1187
|
+
and conversions
|
|
1188
|
+
|
|
1189
|
+
|
|
1190
|
+
* [Units](#module_Units)
|
|
1191
|
+
* _static_
|
|
1192
|
+
* [.saveUnit()](#module_Units.saveUnit) ⇒ <code>Promise.<void></code>
|
|
1193
|
+
* _inner_
|
|
1194
|
+
* [~UnitDefault](#module_Units..UnitDefault) : <code>Unit</code>
|
|
1195
|
+
* [~UnitForm](#module_Units..UnitForm) : <code>Unit</code>
|
|
1196
|
+
* [~UnitData](#module_Units..UnitData) : <code>Unit</code>
|
|
1197
|
+
* [~summarizeUnit(unit)](#module_Units..summarizeUnit) ⇒ <code>string</code>
|
|
1198
|
+
* [~Unit](#module_Units..Unit) : <code>object</code>
|
|
1199
|
+
|
|
1200
|
+
<a name="module_Units.saveUnit"></a>
|
|
1201
|
+
|
|
1202
|
+
### Units.saveUnit() ⇒ <code>Promise.<void></code>
|
|
1203
|
+
Saves a default Stage Settings object to the database
|
|
1204
|
+
|
|
1205
|
+
**Kind**: static method of [<code>Units</code>](#module_Units)
|
|
1206
|
+
**Properties**
|
|
1207
|
+
|
|
1208
|
+
| Name | Type |
|
|
1209
|
+
| --- | --- |
|
|
1210
|
+
| unit | <code>Unit</code> |
|
|
1211
|
+
|
|
1212
|
+
<a name="module_Units..UnitDefault"></a>
|
|
1213
|
+
|
|
1214
|
+
### Units~UnitDefault : <code>Unit</code>
|
|
1215
|
+
**Kind**: inner constant of [<code>Units</code>](#module_Units)
|
|
1216
|
+
**Default**: <code>{"Id":null,"refPath":null,"unit":null,"ratio":1,"otherUnit":null,"system":null}</code>
|
|
1217
|
+
**Read only**: true
|
|
1218
|
+
<a name="module_Units..UnitForm"></a>
|
|
1219
|
+
|
|
1220
|
+
### Units~UnitForm : <code>Unit</code>
|
|
1221
|
+
**Kind**: inner constant of [<code>Units</code>](#module_Units)
|
|
1222
|
+
**Default**: <code>{"unit":"text","ratio":"number","otherUnit":"","system":"string"}</code>
|
|
1223
|
+
**Read only**: true
|
|
1224
|
+
<a name="module_Units..UnitData"></a>
|
|
1225
|
+
|
|
1226
|
+
### Units~UnitData : <code>Unit</code>
|
|
1227
|
+
**Kind**: inner constant of [<code>Units</code>](#module_Units)
|
|
1228
|
+
**Default**: <code>{"unit":"science.unit","otherUnit":"science.unit","ratio":1}</code>
|
|
1229
|
+
**Read only**: true
|
|
1230
|
+
<a name="module_Units..summarizeUnit"></a>
|
|
1231
|
+
|
|
1232
|
+
### Units~summarizeUnit(unit) ⇒ <code>string</code>
|
|
1233
|
+
Returns a standardized formatted name string
|
|
1234
|
+
|
|
1235
|
+
**Kind**: inner method of [<code>Units</code>](#module_Units)
|
|
1236
|
+
**Returns**: <code>string</code> - formatted name string
|
|
1237
|
+
|
|
1238
|
+
| Param | Type |
|
|
1239
|
+
| --- | --- |
|
|
1240
|
+
| unit | <code>Unit</code> |
|
|
1241
|
+
|
|
1242
|
+
<a name="module_Units..Unit"></a>
|
|
1243
|
+
|
|
1244
|
+
### Units~Unit : <code>object</code>
|
|
1245
|
+
A structure to hold Unit name and conversion information
|
|
1246
|
+
This does NOT deal with length/area/volume changes
|
|
1247
|
+
|
|
1248
|
+
**Kind**: inner typedef of [<code>Units</code>](#module_Units)
|
|
1249
|
+
**Properties**
|
|
1250
|
+
|
|
1251
|
+
| Name | Type | Description |
|
|
1252
|
+
| --- | --- | --- |
|
|
1253
|
+
| Id | <code>string</code> | database record Id - random but unique |
|
|
1254
|
+
| refPath | <code>string</code> | database record/document storage path |
|
|
1255
|
+
| unit | <code>string</code> | text version of the unit name |
|
|
1256
|
+
| ratio | <code>number</code> | numerical conversion highValue |
|
|
1257
|
+
| otherUnit | <code>string</code> | other unit to reference against - "name" unit is "ratio" of "other" unit |
|
|
1258
|
+
| system | <code>string</code> | measurement system - imperial, metric, time |
|
|
1259
|
+
|
|
1260
|
+
<a name="module_User"></a>
|
|
1261
|
+
|
|
1262
|
+
## User
|
|
1263
|
+
Typedefs, constants, support functions and database operations related to individual
|
|
1264
|
+
users
|
|
1265
|
+
|
|
1266
|
+
|
|
1267
|
+
* [User](#module_User)
|
|
1268
|
+
* _static_
|
|
1269
|
+
* [.createUser](#module_User.createUser) ⇒ <code>Promise.UserObject</code>
|
|
1270
|
+
* [.deleteUser(user)](#module_User.deleteUser) ⇒ <code>Promise.<void></code>
|
|
1271
|
+
* [.deleteUserById(user)](#module_User.deleteUserById) ⇒ <code>Promise.<void></code>
|
|
1272
|
+
* [.buildUserRecords(user)](#module_User.buildUserRecords) ⇒ <code>Promise.<void></code>
|
|
1273
|
+
* [.updateUserByID(user)](#module_User.updateUserByID) ⇒ <code>promise.UserObject</code>
|
|
1274
|
+
* [.updateUser(user)](#module_User.updateUser) ⇒ <code>promise.UserObject</code>
|
|
1275
|
+
* [.knownUser(Id)](#module_User.knownUser) ⇒ <code>Promise.boolean</code>
|
|
1276
|
+
* [.fetchUsers()](#module_User.fetchUsers) ⇒ <code>Array.UserObject</code>
|
|
1277
|
+
* [.fetchUsersPaginated(limit)](#module_User.fetchUsersPaginated) ⇒ <code>PaginatedFetch</code>
|
|
1278
|
+
* [.fetchAnonymousPaginated(limit)](#module_User.fetchAnonymousPaginated) ⇒ <code>PaginatedFetch</code>
|
|
1279
|
+
* [.fetchUser(userId)](#module_User.fetchUser) ⇒ <code>Promise.UserObject</code>
|
|
1280
|
+
* [.fetchUserName(userId)](#module_User.fetchUserName) ⇒ <code>Promise.string</code>
|
|
1281
|
+
* [.fetchUserEmail(userId)](#module_User.fetchUserEmail) ⇒ <code>Promise.string</code>
|
|
1282
|
+
* [.fetchUserPaymentById(userId)](#module_User.fetchUserPaymentById) ⇒ <code>Promise.PaymentData</code>
|
|
1283
|
+
* [.fetchUserByEmail(email)](#module_User.fetchUserByEmail) ⇒ <code>Promise.UserObject</code>
|
|
1284
|
+
* [.fetchFullUser(userIdentifier)](#module_User.fetchFullUser) ⇒ <code>Promise.UserObject</code>
|
|
1285
|
+
* [.fetchUserFromChild(child)](#module_User.fetchUserFromChild) ⇒ <code>Promise.UserObject</code>
|
|
1286
|
+
* [.userFromId(userId)](#module_User.userFromId) ⇒ <code>UserObject</code>
|
|
1287
|
+
* [.makeUserFromChild(child)](#module_User.makeUserFromChild) ⇒ <code>Record</code>
|
|
1288
|
+
* _inner_
|
|
1289
|
+
* [~UserDefault](#module_User..UserDefault) : <code>UserObject</code>
|
|
1290
|
+
* [~UserData](#module_User..UserData) : <code>UserObject</code>
|
|
1291
|
+
* [~UserDefaultForm](#module_User..UserDefaultForm) : <code>UserObject</code>
|
|
1292
|
+
* [~summarizeUser(user)](#module_User..summarizeUser) ⇒ <code>string</code>
|
|
1293
|
+
* [~UserObject](#module_User..UserObject) : <code>object</code>
|
|
1294
|
+
* [~PaginatedFetch](#module_User..PaginatedFetch) : <code>object</code>
|
|
1295
|
+
|
|
1296
|
+
<a name="module_User.createUser"></a>
|
|
1297
|
+
|
|
1298
|
+
### User.createUser ⇒ <code>Promise.UserObject</code>
|
|
1299
|
+
**Kind**: static constant of [<code>User</code>](#module_User)
|
|
1300
|
+
|
|
1301
|
+
| Param | Type | Description |
|
|
1302
|
+
| --- | --- | --- |
|
|
1303
|
+
| user | <code>UserObject</code> | minimal record of user account |
|
|
1304
|
+
|
|
1305
|
+
<a name="module_User.deleteUser"></a>
|
|
1306
|
+
|
|
1307
|
+
### User.deleteUser(user) ⇒ <code>Promise.<void></code>
|
|
1308
|
+
**Kind**: static method of [<code>User</code>](#module_User)
|
|
1309
|
+
|
|
1310
|
+
| Param | Type |
|
|
1311
|
+
| --- | --- |
|
|
1312
|
+
| user | <code>UserObject</code> |
|
|
1313
|
+
|
|
1314
|
+
<a name="module_User.deleteUserById"></a>
|
|
1315
|
+
|
|
1316
|
+
### User.deleteUserById(user) ⇒ <code>Promise.<void></code>
|
|
1317
|
+
**Kind**: static method of [<code>User</code>](#module_User)
|
|
1318
|
+
|
|
1319
|
+
| Param | Type | Description |
|
|
1320
|
+
| --- | --- | --- |
|
|
1321
|
+
| user | <code>UserObject</code> | minimal record of user account |
|
|
1322
|
+
| user.Id | <code>string</code> | record Id of account |
|
|
1323
|
+
|
|
1324
|
+
<a name="module_User.buildUserRecords"></a>
|
|
1325
|
+
|
|
1326
|
+
### User.buildUserRecords(user) ⇒ <code>Promise.<void></code>
|
|
1327
|
+
Builds a User record from the authentication "user" data
|
|
1328
|
+
|
|
1329
|
+
**Kind**: static method of [<code>User</code>](#module_User)
|
|
1330
|
+
|
|
1331
|
+
| Param | Type |
|
|
1332
|
+
| --- | --- |
|
|
1333
|
+
| user | <code>User</code> |
|
|
1334
|
+
| user.isAnonymous | <code>boolean</code> |
|
|
1335
|
+
| user.displayName | <code>string</code> |
|
|
1336
|
+
| user.photoURL | <code>string</code> |
|
|
1337
|
+
| user.email | <code>string</code> |
|
|
1338
|
+
| user.phoneNumber | <code>string</code> |
|
|
1339
|
+
|
|
1340
|
+
<a name="module_User.updateUserByID"></a>
|
|
1341
|
+
|
|
1342
|
+
### User.updateUserByID(user) ⇒ <code>promise.UserObject</code>
|
|
1343
|
+
writes record back to database. Assumes only Id is valid
|
|
1344
|
+
|
|
1345
|
+
**Kind**: static method of [<code>User</code>](#module_User)
|
|
1346
|
+
**Returns**: <code>promise.UserObject</code> - a copy of the data written
|
|
1347
|
+
|
|
1348
|
+
| Param | Type | Description |
|
|
1349
|
+
| --- | --- | --- |
|
|
1350
|
+
| user | <code>UserObject</code> | a partially-populated user record for updates |
|
|
1351
|
+
|
|
1352
|
+
<a name="module_User.updateUser"></a>
|
|
1353
|
+
|
|
1354
|
+
### User.updateUser(user) ⇒ <code>promise.UserObject</code>
|
|
1355
|
+
writes record back to database. Assumes only Id is valid
|
|
1356
|
+
|
|
1357
|
+
**Kind**: static method of [<code>User</code>](#module_User)
|
|
1358
|
+
**Returns**: <code>promise.UserObject</code> - a copy of the data written
|
|
1359
|
+
|
|
1360
|
+
| Param | Type | Description |
|
|
1361
|
+
| --- | --- | --- |
|
|
1362
|
+
| user | <code>UserObject</code> | a p[artially-populated user record for updates] |
|
|
1363
|
+
|
|
1364
|
+
<a name="module_User.knownUser"></a>
|
|
1365
|
+
|
|
1366
|
+
### User.knownUser(Id) ⇒ <code>Promise.boolean</code>
|
|
1367
|
+
Checks if this is a known UserObject Id
|
|
1368
|
+
|
|
1369
|
+
**Kind**: static method of [<code>User</code>](#module_User)
|
|
1370
|
+
**Returns**: <code>Promise.boolean</code> - true is this Id is in database
|
|
1371
|
+
|
|
1372
|
+
| Param | Type | Description |
|
|
1373
|
+
| --- | --- | --- |
|
|
1374
|
+
| Id | <code>string</code> | Id value to check |
|
|
1375
|
+
|
|
1376
|
+
<a name="module_User.fetchUsers"></a>
|
|
1377
|
+
|
|
1378
|
+
### User.fetchUsers() ⇒ <code>Array.UserObject</code>
|
|
1379
|
+
Fetches ALL user records. Not very useful
|
|
1380
|
+
|
|
1381
|
+
**Kind**: static method of [<code>User</code>](#module_User)
|
|
1382
|
+
<a name="module_User.fetchUsersPaginated"></a>
|
|
1383
|
+
|
|
1384
|
+
### User.fetchUsersPaginated(limit) ⇒ <code>PaginatedFetch</code>
|
|
1385
|
+
Fetchs an object to fetch pages of user data, ascending by name, "limit" at a time
|
|
1386
|
+
|
|
1387
|
+
**Kind**: static method of [<code>User</code>](#module_User)
|
|
1388
|
+
**Returns**: <code>PaginatedFetch</code> - object with pagination methods
|
|
1389
|
+
|
|
1390
|
+
| Param | Type |
|
|
1391
|
+
| --- | --- |
|
|
1392
|
+
| limit | <code>number</code> |
|
|
1393
|
+
|
|
1394
|
+
<a name="module_User.fetchAnonymousPaginated"></a>
|
|
1395
|
+
|
|
1396
|
+
### User.fetchAnonymousPaginated(limit) ⇒ <code>PaginatedFetch</code>
|
|
1397
|
+
Fetchs an object to fetch pages of anonymous user data, ascending by name, "limit" at a time
|
|
1398
|
+
|
|
1399
|
+
**Kind**: static method of [<code>User</code>](#module_User)
|
|
1400
|
+
**Returns**: <code>PaginatedFetch</code> - object with pagination methods
|
|
1401
|
+
|
|
1402
|
+
| Param | Type |
|
|
1403
|
+
| --- | --- |
|
|
1404
|
+
| limit | <code>number</code> |
|
|
1405
|
+
|
|
1406
|
+
<a name="module_User.fetchUser"></a>
|
|
1407
|
+
|
|
1408
|
+
### User.fetchUser(userId) ⇒ <code>Promise.UserObject</code>
|
|
1409
|
+
Fetches a single UserObject record by Id
|
|
1410
|
+
|
|
1411
|
+
**Kind**: static method of [<code>User</code>](#module_User)
|
|
1412
|
+
|
|
1413
|
+
| Param | Type |
|
|
1414
|
+
| --- | --- |
|
|
1415
|
+
| userId | <code>string</code> |
|
|
1416
|
+
|
|
1417
|
+
<a name="module_User.fetchUserName"></a>
|
|
1418
|
+
|
|
1419
|
+
### User.fetchUserName(userId) ⇒ <code>Promise.string</code>
|
|
1420
|
+
Fetches and returns the summarized name from a UserObject record
|
|
1421
|
+
|
|
1422
|
+
**Kind**: static method of [<code>User</code>](#module_User)
|
|
1423
|
+
**Returns**: <code>Promise.string</code> - the summarized name from the record
|
|
1424
|
+
|
|
1425
|
+
| Param | Type |
|
|
1426
|
+
| --- | --- |
|
|
1427
|
+
| userId | <code>string</code> |
|
|
1428
|
+
|
|
1429
|
+
<a name="module_User.fetchUserEmail"></a>
|
|
1430
|
+
|
|
1431
|
+
### User.fetchUserEmail(userId) ⇒ <code>Promise.string</code>
|
|
1432
|
+
Fetches and returns the email from a UserObject record
|
|
1433
|
+
|
|
1434
|
+
**Kind**: static method of [<code>User</code>](#module_User)
|
|
1435
|
+
**Returns**: <code>Promise.string</code> - the email from the record
|
|
1436
|
+
|
|
1437
|
+
| Param | Type |
|
|
1438
|
+
| --- | --- |
|
|
1439
|
+
| userId | <code>string</code> |
|
|
1440
|
+
|
|
1441
|
+
<a name="module_User.fetchUserPaymentById"></a>
|
|
1442
|
+
|
|
1443
|
+
### User.fetchUserPaymentById(userId) ⇒ <code>Promise.PaymentData</code>
|
|
1444
|
+
Fetches the PaymentRecord for a user using just the ID
|
|
1445
|
+
|
|
1446
|
+
**Kind**: static method of [<code>User</code>](#module_User)
|
|
1447
|
+
|
|
1448
|
+
| Param | Type |
|
|
1449
|
+
| --- | --- |
|
|
1450
|
+
| userId | <code>string</code> |
|
|
1451
|
+
|
|
1452
|
+
<a name="module_User.fetchUserByEmail"></a>
|
|
1453
|
+
|
|
1454
|
+
### User.fetchUserByEmail(email) ⇒ <code>Promise.UserObject</code>
|
|
1455
|
+
Fetch a User record by their email
|
|
1456
|
+
|
|
1457
|
+
**Kind**: static method of [<code>User</code>](#module_User)
|
|
1458
|
+
|
|
1459
|
+
| Param | Type |
|
|
1460
|
+
| --- | --- |
|
|
1461
|
+
| email | <code>string</code> |
|
|
1462
|
+
|
|
1463
|
+
<a name="module_User.fetchFullUser"></a>
|
|
1464
|
+
|
|
1465
|
+
### User.fetchFullUser(userIdentifier) ⇒ <code>Promise.UserObject</code>
|
|
1466
|
+
fetches a full user object (address, payment, private, etc) given EITHER
|
|
1467
|
+
just the Id, OR a UserObject
|
|
1468
|
+
|
|
1469
|
+
**Kind**: static method of [<code>User</code>](#module_User)
|
|
1470
|
+
|
|
1471
|
+
| Param | Type |
|
|
1472
|
+
| --- | --- |
|
|
1473
|
+
| userIdentifier | <code>string</code> \| <code>UserObject</code> |
|
|
1474
|
+
| userIdentifier.Id | <code>string</code> |
|
|
1475
|
+
|
|
1476
|
+
<a name="module_User.fetchUserFromChild"></a>
|
|
1477
|
+
|
|
1478
|
+
### User.fetchUserFromChild(child) ⇒ <code>Promise.UserObject</code>
|
|
1479
|
+
Fetches a UserObject from any child record in any branch
|
|
1480
|
+
|
|
1481
|
+
**Kind**: static method of [<code>User</code>](#module_User)
|
|
1482
|
+
|
|
1483
|
+
| Param | Type |
|
|
1484
|
+
| --- | --- |
|
|
1485
|
+
| child | <code>RecordDocument</code> |
|
|
1486
|
+
|
|
1487
|
+
<a name="module_User.userFromId"></a>
|
|
1488
|
+
|
|
1489
|
+
### User.userFromId(userId) ⇒ <code>UserObject</code>
|
|
1490
|
+
builds a minimal UserObject from an Id
|
|
1491
|
+
|
|
1492
|
+
**Kind**: static method of [<code>User</code>](#module_User)
|
|
1493
|
+
|
|
1494
|
+
| Param | Type |
|
|
1495
|
+
| --- | --- |
|
|
1496
|
+
| userId | <code>string</code> |
|
|
1497
|
+
|
|
1498
|
+
<a name="module_User.makeUserFromChild"></a>
|
|
1499
|
+
|
|
1500
|
+
### User.makeUserFromChild(child) ⇒ <code>Record</code>
|
|
1501
|
+
**Kind**: static method of [<code>User</code>](#module_User)
|
|
1502
|
+
|
|
1503
|
+
| Param | Type | Description |
|
|
1504
|
+
| --- | --- | --- |
|
|
1505
|
+
| child | <code>Record</code> | a record assumed to be a leaf/child |
|
|
1506
|
+
|
|
1507
|
+
<a name="module_User..UserDefault"></a>
|
|
1508
|
+
|
|
1509
|
+
### User~UserDefault : <code>UserObject</code>
|
|
1510
|
+
**Kind**: inner constant of [<code>User</code>](#module_User)
|
|
1511
|
+
**Default**: <code>{"Id":null,"refPath":null,"name":null,"email":null,"tel":null,"isAnonymous":true,"payment_method":null,"admin_status":null}</code>
|
|
1512
|
+
**Read only**: true
|
|
1513
|
+
<a name="module_User..UserData"></a>
|
|
1514
|
+
|
|
1515
|
+
### User~UserData : <code>UserObject</code>
|
|
1516
|
+
**Kind**: inner constant of [<code>User</code>](#module_User)
|
|
1517
|
+
**Default**: <code>{"Id":"","refPath":null,"name":"","email":"","tel":"","isAnonymous":"","payment_method":null,"admin_status":null}</code>
|
|
1518
|
+
**Read only**: true
|
|
1519
|
+
<a name="module_User..UserDefaultForm"></a>
|
|
1520
|
+
|
|
1521
|
+
### User~UserDefaultForm : <code>UserObject</code>
|
|
1522
|
+
**Kind**: inner constant of [<code>User</code>](#module_User)
|
|
1523
|
+
**Default**: <code>{"name":"text","email":"email","tel":"tel"}</code>
|
|
1524
|
+
**Read only**: true
|
|
1525
|
+
<a name="module_User..summarizeUser"></a>
|
|
1526
|
+
|
|
1527
|
+
### User~summarizeUser(user) ⇒ <code>string</code>
|
|
1528
|
+
Returns a standardized formatted name string
|
|
1529
|
+
|
|
1530
|
+
**Kind**: inner method of [<code>User</code>](#module_User)
|
|
1531
|
+
**Returns**: <code>string</code> - formatted name string
|
|
1532
|
+
|
|
1533
|
+
| Param | Type |
|
|
1534
|
+
| --- | --- |
|
|
1535
|
+
| user | <code>UserObject</code> |
|
|
1536
|
+
|
|
1537
|
+
<a name="module_User..UserObject"></a>
|
|
1538
|
+
|
|
1539
|
+
### User~UserObject : <code>object</code>
|
|
1540
|
+
**Kind**: inner typedef of [<code>User</code>](#module_User)
|
|
1541
|
+
**Properties**
|
|
1542
|
+
|
|
1543
|
+
| Name | Type | Description |
|
|
1544
|
+
| --- | --- | --- |
|
|
1545
|
+
| Id | <code>string</code> | Id of document from storage |
|
|
1546
|
+
| refPath | <code>string</code> | if from database, full path to document |
|
|
1547
|
+
| first_name | <code>string</code> | could be "Anonymous" |
|
|
1548
|
+
| last_name | <code>string</code> | |
|
|
1549
|
+
| isAnonymous | <code>boolean</code> | flag indicating auto-generated Anonymous user account |
|
|
1550
|
+
| image | <code>url</code> | URL (possibly in app storage) of User image |
|
|
1551
|
+
| region | <code>string</code> | User home region, from fixed list |
|
|
1552
|
+
| [social_links] | <code>url</code> | array of user social account links |
|
|
1553
|
+
| bio | <code>string</code> | user-maintained biography |
|
|
1554
|
+
| website | <code>url</code> | URL to user user website |
|
|
1555
|
+
| payment_method | <code>string</code> | summary string of user payment method. Not secure, not source-of-truth |
|
|
1556
|
+
| payment | <code>PaymentData</code> | when "full account" |
|
|
1557
|
+
|
|
1558
|
+
<a name="module_User..PaginatedFetch"></a>
|
|
1559
|
+
|
|
1560
|
+
### User~PaginatedFetch : <code>object</code>
|
|
1561
|
+
An object to allow for paginating a table read from Firestore. REQUIRES a sorting choice
|
|
1562
|
+
|
|
1563
|
+
**Kind**: inner typedef of [<code>User</code>](#module_User)
|
|
1564
|
+
**Properties**
|
|
1565
|
+
|
|
1566
|
+
| Name | Type | Description |
|
|
1567
|
+
| --- | --- | --- |
|
|
1568
|
+
| Query | <code>Query</code> | that forms basis for the table read |
|
|
1569
|
+
| limit | <code>number</code> | page size |
|
|
1570
|
+
| snapshot | <code>QuerySnapshot</code> | last successful snapshot/page fetched |
|
|
1571
|
+
| status | <code>enum</code> | status of pagination object |
|
|
1572
|
+
| PageForward | <code>method</code> | pages the fetch forward |
|
|
1573
|
+
| PageBack | <code>method</code> | pages the fetch backward |
|
|
1574
|
+
|
|
1575
|
+
<a name="module_Utilities"></a>
|
|
1576
|
+
|
|
1577
|
+
## Utilities
|
|
1578
|
+
Typedefs, constants, support functions and database operations related to usage Units
|
|
1579
|
+
and conversions
|
|
1580
|
+
|
|
1581
|
+
|
|
1582
|
+
* [Utilities](#module_Utilities)
|
|
1583
|
+
* _static_
|
|
1584
|
+
* [.recordByIdAndType](#module_Utilities.recordByIdAndType) ⇒ <code>AccountType</code>
|
|
1585
|
+
* [.fetchLinkedItem(type, link, refPath)](#module_Utilities.fetchLinkedItem) ⇒ <code>Promise.RecordDocument</code>
|
|
1586
|
+
* [.fetchSubItem(type, refPath)](#module_Utilities.fetchSubItem) ⇒ <code>Promise.RecordDocument</code>
|
|
1587
|
+
* [.fetchType(type, refPath)](#module_Utilities.fetchType) ⇒ <code>Promise.Array.RecordDocument</code>
|
|
1588
|
+
* [.searchType(type, parent, prompt, limit)](#module_Utilities.searchType) ⇒ <code>Promise.Array.OrganizationType</code>
|
|
1589
|
+
* [.typedRecordFromChild(type, child)](#module_Utilities.typedRecordFromChild) ⇒ <code>Record</code>
|
|
1590
|
+
* [.typedSortArray(type)](#module_Utilities.typedSortArray) ⇒ <code>Array.SortObject</code>
|
|
1591
|
+
* [.processItemType(item, type, refPath)](#module_Utilities.processItemType) ⇒ <code>Promise.RecordDocument</code>
|
|
1592
|
+
* [.formatLinkedItem(link, type, refPath)](#module_Utilities.formatLinkedItem) ⇒ <code>Promise.string</code>
|
|
1593
|
+
* [.summarizeItem(item, type)](#module_Utilities.summarizeItem) ⇒ <code>string</code>
|
|
1594
|
+
* [.baseItem(type)](#module_Utilities.baseItem) ⇒ <code>object</code>
|
|
1595
|
+
* [.baseForm(type)](#module_Utilities.baseForm) ⇒ <code>object</code>
|
|
1596
|
+
* [.dataForm(type)](#module_Utilities.dataForm) ⇒ <code>object</code>
|
|
1597
|
+
* [.createForm(type)](#module_Utilities.createForm) ⇒ <code>object</code>
|
|
1598
|
+
* [.accountForm(type)](#module_Utilities.accountForm) ⇒ <code>object</code>
|
|
1599
|
+
* [.saveForm(type)](#module_Utilities.saveForm) ⇒ <code>callback</code>
|
|
1600
|
+
* [.updateChangeForm(type)](#module_Utilities.updateChangeForm) ⇒ <code>callback</code>
|
|
1601
|
+
* [.choicesForm(fieldname)](#module_Utilities.choicesForm) ⇒ <code>object</code>
|
|
1602
|
+
* _inner_
|
|
1603
|
+
* [~stripDocIdFromRefPath(refPath)](#module_Utilities..stripDocIdFromRefPath) ⇒ <code>string</code>
|
|
1604
|
+
* [~UpdateChange
|
|
1605
|
+
Function Signature for UpdateChange functions(prev, value, itemFor, fullChoiceObject)](#module_Utilities..UpdateChange
|
|
1606
|
+
Function Signature for UpdateChange functions) ⇒ <code>object</code>
|
|
1607
|
+
|
|
1608
|
+
<a name="module_Utilities.recordByIdAndType"></a>
|
|
1609
|
+
|
|
1610
|
+
### Utilities.recordByIdAndType ⇒ <code>AccountType</code>
|
|
1611
|
+
creates and returns a minimal record from an Id and `type`
|
|
1612
|
+
|
|
1613
|
+
**Kind**: static constant of [<code>Utilities</code>](#module_Utilities)
|
|
1614
|
+
|
|
1615
|
+
| Param | Type |
|
|
1616
|
+
| --- | --- |
|
|
1617
|
+
| Id | <code>string</code> |
|
|
1618
|
+
| Type | <code>string</code> |
|
|
1619
|
+
|
|
1620
|
+
<a name="module_Utilities.fetchLinkedItem"></a>
|
|
1621
|
+
|
|
1622
|
+
### Utilities.fetchLinkedItem(type, link, refPath) ⇒ <code>Promise.RecordDocument</code>
|
|
1623
|
+
used generic for constructing forms for input and display
|
|
1624
|
+
|
|
1625
|
+
**Kind**: static method of [<code>Utilities</code>](#module_Utilities)
|
|
1626
|
+
|
|
1627
|
+
| Param | Type | Description |
|
|
1628
|
+
| --- | --- | --- |
|
|
1629
|
+
| type | <code>string</code> | refers to the sub-collection name |
|
|
1630
|
+
| link | <code>string</code> | refers to the linking "value" - a documentID |
|
|
1631
|
+
| refPath | <code>string</code> | optionally refers to the "/" separate path to the parent document in firebase |
|
|
1632
|
+
|
|
1633
|
+
<a name="module_Utilities.fetchSubItem"></a>
|
|
1634
|
+
|
|
1635
|
+
### Utilities.fetchSubItem(type, refPath) ⇒ <code>Promise.RecordDocument</code>
|
|
1636
|
+
some items are stored in the database as a single-record collection, using
|
|
1637
|
+
the same Id as the parent
|
|
1638
|
+
|
|
1639
|
+
**Kind**: static method of [<code>Utilities</code>](#module_Utilities)
|
|
1640
|
+
|
|
1641
|
+
| Param | Type | Description |
|
|
1642
|
+
| --- | --- | --- |
|
|
1643
|
+
| type | <code>string</code> | refers to the sub-collection name |
|
|
1644
|
+
| refPath | <code>string</code> | refers to the "/" separate path to the required parent document in firebase |
|
|
1645
|
+
|
|
1646
|
+
<a name="module_Utilities.fetchType"></a>
|
|
1647
|
+
|
|
1648
|
+
### Utilities.fetchType(type, refPath) ⇒ <code>Promise.Array.RecordDocument</code>
|
|
1649
|
+
returns an entire sub-collection by "type" (sub-collection name).
|
|
1650
|
+
If refpath is omitted, assumes "type" is a top-level collection
|
|
1651
|
+
|
|
1652
|
+
**Kind**: static method of [<code>Utilities</code>](#module_Utilities)
|
|
1653
|
+
|
|
1654
|
+
| Param | Type | Description |
|
|
1655
|
+
| --- | --- | --- |
|
|
1656
|
+
| type | <code>string</code> | refers to the sub-collection name |
|
|
1657
|
+
| refPath | <code>string</code> | optionally refers to the "/" separate path to the parent document in firebase |
|
|
1658
|
+
|
|
1659
|
+
<a name="module_Utilities.searchType"></a>
|
|
1660
|
+
|
|
1661
|
+
### Utilities.searchType(type, parent, prompt, limit) ⇒ <code>Promise.Array.OrganizationType</code>
|
|
1662
|
+
returns a Promise which resolves to an array of all Type's whose
|
|
1663
|
+
name begins with the provided prompt, optionally limited to a provided number
|
|
1664
|
+
CASE SENSITIVE FOR NOW
|
|
1665
|
+
|
|
1666
|
+
**Kind**: static method of [<code>Utilities</code>](#module_Utilities)
|
|
1667
|
+
|
|
1668
|
+
| Param | Type | Description |
|
|
1669
|
+
| --- | --- | --- |
|
|
1670
|
+
| type | <code>string</code> | type of record to search |
|
|
1671
|
+
| parent | <code>Record</code> | parent object of records, if any |
|
|
1672
|
+
| prompt | <code>string</code> | Used to query for matching records |
|
|
1673
|
+
| limit | <code>string</code> \| <code>number</code> | Used to limit the number of results |
|
|
1674
|
+
|
|
1675
|
+
<a name="module_Utilities.typedRecordFromChild"></a>
|
|
1676
|
+
|
|
1677
|
+
### Utilities.typedRecordFromChild(type, child) ⇒ <code>Record</code>
|
|
1678
|
+
builds a representation of a parent from a child, by type
|
|
1679
|
+
|
|
1680
|
+
**Kind**: static method of [<code>Utilities</code>](#module_Utilities)
|
|
1681
|
+
|
|
1682
|
+
| Param | Type |
|
|
1683
|
+
| --- | --- |
|
|
1684
|
+
| type | <code>string</code> |
|
|
1685
|
+
| child | <code>Record</code> |
|
|
1686
|
+
|
|
1687
|
+
<a name="module_Utilities.typedSortArray"></a>
|
|
1688
|
+
|
|
1689
|
+
### Utilities.typedSortArray(type) ⇒ <code>Array.SortObject</code>
|
|
1690
|
+
Firebase query support - builds default sort options
|
|
1691
|
+
|
|
1692
|
+
**Kind**: static method of [<code>Utilities</code>](#module_Utilities)
|
|
1693
|
+
|
|
1694
|
+
| Param | Type |
|
|
1695
|
+
| --- | --- |
|
|
1696
|
+
| type | <code>string</code> |
|
|
1697
|
+
|
|
1698
|
+
<a name="module_Utilities.processItemType"></a>
|
|
1699
|
+
|
|
1700
|
+
### Utilities.processItemType(item, type, refPath) ⇒ <code>Promise.RecordDocument</code>
|
|
1701
|
+
generic form data processing for database by "type" (collection name)
|
|
1702
|
+
|
|
1703
|
+
**Kind**: static method of [<code>Utilities</code>](#module_Utilities)
|
|
1704
|
+
|
|
1705
|
+
| Param | Type | Description |
|
|
1706
|
+
| --- | --- | --- |
|
|
1707
|
+
| item | <code>RecordDocument</code> | |
|
|
1708
|
+
| type | <code>string</code> | refers to the sub-collection name |
|
|
1709
|
+
| refPath | <code>string</code> | optionally refers to the "/" separate path to the parent document in firebase |
|
|
1710
|
+
|
|
1711
|
+
<a name="module_Utilities.formatLinkedItem"></a>
|
|
1712
|
+
|
|
1713
|
+
### Utilities.formatLinkedItem(link, type, refPath) ⇒ <code>Promise.string</code>
|
|
1714
|
+
fetches a sub-record from the database and returns the result as a summary string
|
|
1715
|
+
|
|
1716
|
+
**Kind**: static method of [<code>Utilities</code>](#module_Utilities)
|
|
1717
|
+
|
|
1718
|
+
| Param | Type | Description |
|
|
1719
|
+
| --- | --- | --- |
|
|
1720
|
+
| link | <code>string</code> | refers to the linking "value" - a documentID |
|
|
1721
|
+
| type | <code>string</code> | refers to the sub-collection name |
|
|
1722
|
+
| refPath | <code>string</code> | refers to the "/" separate path to the required parent document in firebase |
|
|
1723
|
+
|
|
1724
|
+
<a name="module_Utilities.summarizeItem"></a>
|
|
1725
|
+
|
|
1726
|
+
### Utilities.summarizeItem(item, type) ⇒ <code>string</code>
|
|
1727
|
+
parameterized function to return string summary of an object
|
|
1728
|
+
By default, returns the "name" property of the item.
|
|
1729
|
+
|
|
1730
|
+
**Kind**: static method of [<code>Utilities</code>](#module_Utilities)
|
|
1731
|
+
|
|
1732
|
+
| Param | Type | Description |
|
|
1733
|
+
| --- | --- | --- |
|
|
1734
|
+
| item | <code>object</code> | data object to summarize |
|
|
1735
|
+
| type | <code>String</code> \| <code>"User"</code> \| <code>"Product"</code> \| <code>"LineItem"</code> \| <code>"Commodities"</code> \| <code>"Units"</code> | - type of the object to summarize |
|
|
1736
|
+
|
|
1737
|
+
<a name="module_Utilities.baseItem"></a>
|
|
1738
|
+
|
|
1739
|
+
### Utilities.baseItem(type) ⇒ <code>object</code>
|
|
1740
|
+
Convenience function to mask actual Forms array from the front-end
|
|
1741
|
+
This version returns the "base" item sample for a business-object type,
|
|
1742
|
+
where the keys are the field/property names, and the values are the
|
|
1743
|
+
default values as defined in the business logic
|
|
1744
|
+
|
|
1745
|
+
**Kind**: static method of [<code>Utilities</code>](#module_Utilities)
|
|
1746
|
+
**Returns**: <code>object</code> - keys and default values
|
|
1747
|
+
|
|
1748
|
+
| Param | Type |
|
|
1749
|
+
| --- | --- |
|
|
1750
|
+
| type | <code>string</code> |
|
|
1751
|
+
|
|
1752
|
+
<a name="module_Utilities.baseForm"></a>
|
|
1753
|
+
|
|
1754
|
+
### Utilities.baseForm(type) ⇒ <code>object</code>
|
|
1755
|
+
Convenience function to mask actual Forms array from the front-end
|
|
1756
|
+
This version returns the "baseForm" withe keys/properties, and
|
|
1757
|
+
values are strings with ":" separated definitions for EditForm and
|
|
1758
|
+
similar functionality - see "EditForm" for more details
|
|
1759
|
+
|
|
1760
|
+
**Kind**: static method of [<code>Utilities</code>](#module_Utilities)
|
|
1761
|
+
**Returns**: <code>object</code> - keys and default values
|
|
1762
|
+
|
|
1763
|
+
| Param | Type |
|
|
1764
|
+
| --- | --- |
|
|
1765
|
+
| type | <code>string</code> |
|
|
1766
|
+
|
|
1767
|
+
<a name="module_Utilities.dataForm"></a>
|
|
1768
|
+
|
|
1769
|
+
### Utilities.dataForm(type) ⇒ <code>object</code>
|
|
1770
|
+
Convenience function to mask actual Forms array from the front-end
|
|
1771
|
+
This version returns the "Data" object with keys/properties, and
|
|
1772
|
+
values are strings with ":" separated definitions for Faker and
|
|
1773
|
+
similar functionality - to generate "fake" simulated data for testing
|
|
1774
|
+
|
|
1775
|
+
**Kind**: static method of [<code>Utilities</code>](#module_Utilities)
|
|
1776
|
+
**Returns**: <code>object</code> - keys and default values
|
|
1777
|
+
|
|
1778
|
+
| Param | Type |
|
|
1779
|
+
| --- | --- |
|
|
1780
|
+
| type | <code>string</code> |
|
|
1781
|
+
|
|
1782
|
+
<a name="module_Utilities.createForm"></a>
|
|
1783
|
+
|
|
1784
|
+
### Utilities.createForm(type) ⇒ <code>object</code>
|
|
1785
|
+
Convenience function to mask actual Forms array from the front-end
|
|
1786
|
+
This version returns the "createForm" withe keys/properties, and
|
|
1787
|
+
values are strings with ":" separated definitions for EditForm and
|
|
1788
|
+
similar functionality - see "EditForm" for more details
|
|
1789
|
+
Specifically for limited "front-end" use to CREATE new
|
|
1790
|
+
business-objects with the minimum entries necessary
|
|
1791
|
+
|
|
1792
|
+
**Kind**: static method of [<code>Utilities</code>](#module_Utilities)
|
|
1793
|
+
**Returns**: <code>object</code> - keys and default values
|
|
1794
|
+
|
|
1795
|
+
| Param | Type |
|
|
1796
|
+
| --- | --- |
|
|
1797
|
+
| type | <code>string</code> |
|
|
1798
|
+
|
|
1799
|
+
<a name="module_Utilities.accountForm"></a>
|
|
1800
|
+
|
|
1801
|
+
### Utilities.accountForm(type) ⇒ <code>object</code>
|
|
1802
|
+
Convenience function to mask actual Forms array from the front-end
|
|
1803
|
+
This version returns the "createForm" withe keys/properties, and
|
|
1804
|
+
values are strings with ":" separated definitions for EditForm and
|
|
1805
|
+
similar functionality - see "EditForm" for more details
|
|
1806
|
+
Specifically for limited "front-end" use on ACCOUNT business-objects
|
|
1807
|
+
with the minimum entries necessary
|
|
1808
|
+
|
|
1809
|
+
**Kind**: static method of [<code>Utilities</code>](#module_Utilities)
|
|
1810
|
+
**Returns**: <code>object</code> - keys and default values
|
|
1811
|
+
|
|
1812
|
+
| Param | Type |
|
|
1813
|
+
| --- | --- |
|
|
1814
|
+
| type | <code>string</code> |
|
|
1815
|
+
|
|
1816
|
+
<a name="module_Utilities.saveForm"></a>
|
|
1817
|
+
|
|
1818
|
+
### Utilities.saveForm(type) ⇒ <code>callback</code>
|
|
1819
|
+
Convenience function to mask actual Forms array from the front-end
|
|
1820
|
+
This version returns a FUNCTION to use for saving a business-object
|
|
1821
|
+
to the database - abstracting type-specific features and functionality
|
|
1822
|
+
from the front end
|
|
1823
|
+
|
|
1824
|
+
**Kind**: static method of [<code>Utilities</code>](#module_Utilities)
|
|
1825
|
+
|
|
1826
|
+
| Param | Type |
|
|
1827
|
+
| --- | --- |
|
|
1828
|
+
| type | <code>string</code> |
|
|
1829
|
+
|
|
1830
|
+
<a name="module_Utilities.updateChangeForm"></a>
|
|
1831
|
+
|
|
1832
|
+
### Utilities.updateChangeForm(type) ⇒ <code>callback</code>
|
|
1833
|
+
Convenience function to mask actual Forms array from the front-end
|
|
1834
|
+
This version returns a FUNCTION to respond to cross-field dependent
|
|
1835
|
+
chnages during editing with EditForm, reactdatagrid, etc
|
|
1836
|
+
|
|
1837
|
+
**Kind**: static method of [<code>Utilities</code>](#module_Utilities)
|
|
1838
|
+
|
|
1839
|
+
| Param | Type |
|
|
1840
|
+
| --- | --- |
|
|
1841
|
+
| type | <code>string</code> |
|
|
1842
|
+
|
|
1843
|
+
<a name="module_Utilities.choicesForm"></a>
|
|
1844
|
+
|
|
1845
|
+
### Utilities.choicesForm(fieldname) ⇒ <code>object</code>
|
|
1846
|
+
Returns an object whose keys are the available choices for a
|
|
1847
|
+
business-object field, and whose values represent the sort order
|
|
1848
|
+
Most fieldname have no such choices. Both the definitions and
|
|
1849
|
+
usage are defined in business logic elsewhere
|
|
1850
|
+
|
|
1851
|
+
**Kind**: static method of [<code>Utilities</code>](#module_Utilities)
|
|
1852
|
+
|
|
1853
|
+
| Param | Type | Description |
|
|
1854
|
+
| --- | --- | --- |
|
|
1855
|
+
| fieldname | <code>string</code> | which business type is being processes |
|
|
1856
|
+
|
|
1857
|
+
<a name="module_Utilities..stripDocIdFromRefPath"></a>
|
|
1858
|
+
|
|
1859
|
+
### Utilities~stripDocIdFromRefPath(refPath) ⇒ <code>string</code>
|
|
1860
|
+
pulls the document Id from a passed refPath string (firebase dependent)
|
|
1861
|
+
|
|
1862
|
+
**Kind**: inner method of [<code>Utilities</code>](#module_Utilities)
|
|
1863
|
+
**Returns**: <code>string</code> - Id
|
|
1864
|
+
|
|
1865
|
+
| Param | Type |
|
|
1866
|
+
| --- | --- |
|
|
1867
|
+
| refPath | <code>string</code> |
|
|
1868
|
+
|
|
1869
|
+
<a name="module_Utilities..UpdateChange
|
|
1870
|
+
Function Signature for UpdateChange functions"></a>
|
|
1871
|
+
|
|
1872
|
+
### Utilities~UpdateChange
|
|
1873
|
+
Function Signature for UpdateChange functions(prev, value, itemFor, fullChoiceObject) ⇒ <code>object</code>
|
|
1874
|
+
**Kind**: inner method of [<code>Utilities</code>](#module_Utilities)
|
|
1875
|
+
|
|
1876
|
+
| Param | Type |
|
|
1877
|
+
| --- | --- |
|
|
1878
|
+
| prev | <code>object</code> |
|
|
1879
|
+
| value | <code>object</code> |
|
|
1880
|
+
| itemFor | <code>string</code> |
|
|
1881
|
+
| fullChoiceObject | <code>object</code> |
|
|
1882
|
+
|
|
1883
|
+
<a name="module_InventoryLogic"></a>
|
|
1884
|
+
|
|
1885
|
+
## InventoryLogic
|
|
1886
|
+
Business Logic for the PaaS, wrapped
|
|
1887
|
+
around FirebaseWrapper, to be shared between Back and Front End.
|
|
1888
|
+
This particular library only provides the business "logic" - not browser
|
|
1889
|
+
services.
|
|
1890
|
+
|
|
1891
|
+
|
|
1892
|
+
* [InventoryLogic](#module_InventoryLogic)
|
|
1893
|
+
* _static_
|
|
1894
|
+
* [.databaseStart(firebase, config, thisLogger)](#module_InventoryLogic.databaseStart) ⇒ <code>Promise.Firebase.app</code>
|
|
1895
|
+
* _inner_
|
|
1896
|
+
* [~FirebaseConfigObject](#module_InventoryLogic..FirebaseConfigObject) : <code>object</code>
|
|
1897
|
+
|
|
1898
|
+
<a name="module_InventoryLogic.databaseStart"></a>
|
|
1899
|
+
|
|
1900
|
+
### InventoryLogic.databaseStart(firebase, config, thisLogger) ⇒ <code>Promise.Firebase.app</code>
|
|
1901
|
+
all-in-one wrapper for a solid subset of CLIENT-SIDE Firebase
|
|
1902
|
+
functions, with a consistent interface. There is a parallel set for
|
|
1903
|
+
ADMIN-SIDE functions as well.
|
|
1904
|
+
Call/initialize with Firebase Configuration settings in an object as
|
|
1905
|
+
described below
|
|
1906
|
+
|
|
1907
|
+
**Kind**: static method of [<code>InventoryLogic</code>](#module_InventoryLogic)
|
|
1908
|
+
|
|
1909
|
+
| Param | Type | Description |
|
|
1910
|
+
| --- | --- | --- |
|
|
1911
|
+
| firebase | <code>Firebase</code> | |
|
|
1912
|
+
| config | <code>FirebaseConfigObject</code> | Firebase Admin object |
|
|
1913
|
+
| thisLogger | <code>callback</code> | |
|
|
1914
|
+
|
|
1915
|
+
**Example**
|
|
1916
|
+
```
|
|
1917
|
+
//this specifically loads ALL the subsections, specifically for
|
|
1918
|
+
//the Browser. See later (tbd) notes for NodeJS
|
|
1919
|
+
|
|
1920
|
+
import FirebaseWrapper from "@leaddreamer/firebase-wrapper";
|
|
1921
|
+
FirebaseWrapper(config); //see below
|
|
1922
|
+
export * from "@leaddreamer/firebase-wrapper";
|
|
1923
|
+
```
|
|
1924
|
+
<a name="module_InventoryLogic..FirebaseConfigObject"></a>
|
|
1925
|
+
|
|
1926
|
+
### InventoryLogic~FirebaseConfigObject : <code>object</code>
|
|
1927
|
+
only authDomain, databaseURL and storageBucket are present when
|
|
1928
|
+
called from a cloud environment
|
|
1929
|
+
|
|
1930
|
+
**Kind**: inner typedef of [<code>InventoryLogic</code>](#module_InventoryLogic)
|
|
1931
|
+
**Properties**
|
|
1932
|
+
|
|
1933
|
+
| Name | Type | Description |
|
|
1934
|
+
| --- | --- | --- |
|
|
1935
|
+
| apiKey | <code>string</code> | required api Key from Firebase Console, |
|
|
1936
|
+
| appId | <code>string</code> | required app ID from Firebase Console |
|
|
1937
|
+
| projectId | <code>string</code> | required Firebase projectID from Firebase console |
|
|
1938
|
+
| authDomain | <code>string</code> | (optional) auth domain from Firebase Console |
|
|
1939
|
+
| databaseURL | <code>string</code> | (optional) Firestore database URL from Firebase console |
|
|
1940
|
+
| storageBucket: | <code>string</code> | (optional) URL of Firestore Storage Bucket |
|
|
1941
|
+
| messagingSenderId: | <code>string</code> | (optional) ID for Messaing service from Firebase Console |
|
|
1942
|
+
| measurementId: | <code>string</code> | (optional) Analytics/Measurement ID from Firebase Console |
|
|
1943
|
+
| mapsAPIKey | <code>string</code> | (optional) App ID for Google Maps API, from Google |
|
|
1944
|
+
|
|
1945
|
+
|
|
1946
|
+
* * *
|
|
1947
|
+
|
|
1948
|
+
© 2020-2025 Tracy Hall / Dreams and Logic Inc / SaltSweetSpirits
|