| A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | Items (make up the fixed catalog, don't belong to users) | |||||||||||||||||||||||||
2 | id | unique id / primary key | ||||||||||||||||||||||||
3 | name | string | ||||||||||||||||||||||||
5 | price | number (integer in USD cents) | ||||||||||||||||||||||||
9 | ||||||||||||||||||||||||||
10 | Orders (belong to one user, reference many items) | |||||||||||||||||||||||||
11 | id | unique id / primary key | ||||||||||||||||||||||||
12 | owned_by | string that is a REFERENCE to a user id | ||||||||||||||||||||||||
13 | items | array of objects that each look like this: | ||||||||||||||||||||||||
14 | { | |||||||||||||||||||||||||
15 | item: REFERENCE string | "populate" (v subdocuments) | ||||||||||||||||||||||||
16 | qty: integer | make sure you fix in time the price you ended up paying | ||||||||||||||||||||||||
17 | unit_price: VIRTUAL pulling from the price field on the | |||||||||||||||||||||||||
18 | referenced item (integer in USD cents) | |||||||||||||||||||||||||
19 | } | |||||||||||||||||||||||||
20 | total | VIRTUAL integer in USD cents | Note: Stripe requires amount to be in cents | |||||||||||||||||||||||
21 | obtained by looping through the objects in items array and | |||||||||||||||||||||||||
22 | calculating unit_price x quantity for each and adding up | |||||||||||||||||||||||||
23 | the qty x unit price of each | |||||||||||||||||||||||||
24 | checkoutComplete | boolean (defaults to false) | ||||||||||||||||||||||||
45 | ||||||||||||||||||||||||||
46 | ||||||||||||||||||||||||||
47 | ||||||||||||||||||||||||||
48 | ||||||||||||||||||||||||||
49 | Users (have many orders, which in turn reference many items) | |||||||||||||||||||||||||
50 | id | unique id / primary key | ||||||||||||||||||||||||
51 | string | |||||||||||||||||||||||||
52 | password | string | ||||||||||||||||||||||||
53 | orders | array of strings which are references keys to orders | ||||||||||||||||||||||||
73 | ||||||||||||||||||||||||||
74 | ||||||||||||||||||||||||||
75 | ||||||||||||||||||||||||||
76 | ||||||||||||||||||||||||||
77 | ||||||||||||||||||||||||||
78 | ||||||||||||||||||||||||||
79 | ||||||||||||||||||||||||||
80 | ||||||||||||||||||||||||||
81 | ||||||||||||||||||||||||||
82 | ||||||||||||||||||||||||||
83 | ||||||||||||||||||||||||||
84 | ||||||||||||||||||||||||||
85 | ||||||||||||||||||||||||||
86 | ||||||||||||||||||||||||||
87 | ||||||||||||||||||||||||||
88 | ||||||||||||||||||||||||||
89 | ||||||||||||||||||||||||||
90 | ||||||||||||||||||||||||||
91 | ||||||||||||||||||||||||||
92 | ||||||||||||||||||||||||||
93 | ||||||||||||||||||||||||||
94 | ||||||||||||||||||||||||||
95 | ||||||||||||||||||||||||||
96 | ||||||||||||||||||||||||||
97 | ||||||||||||||||||||||||||
98 | ||||||||||||||||||||||||||
99 | ||||||||||||||||||||||||||
100 | ||||||||||||||||||||||||||
101 | ||||||||||||||||||||||||||
102 | ||||||||||||||||||||||||||
103 | ||||||||||||||||||||||||||
104 | ||||||||||||||||||||||||||
105 | ||||||||||||||||||||||||||
106 | ||||||||||||||||||||||||||
107 | ||||||||||||||||||||||||||
108 | ||||||||||||||||||||||||||
109 | ||||||||||||||||||||||||||
110 | ||||||||||||||||||||||||||
111 | ||||||||||||||||||||||||||
112 | ||||||||||||||||||||||||||
113 | ||||||||||||||||||||||||||
114 | ||||||||||||||||||||||||||
115 | ||||||||||||||||||||||||||
116 | ||||||||||||||||||||||||||
117 | ||||||||||||||||||||||||||
118 | ||||||||||||||||||||||||||
119 | ||||||||||||||||||||||||||
120 | ||||||||||||||||||||||||||
121 | ||||||||||||||||||||||||||
122 | ||||||||||||||||||||||||||
123 | ||||||||||||||||||||||||||
124 | ||||||||||||||||||||||||||
125 | ||||||||||||||||||||||||||
126 | ||||||||||||||||||||||||||
127 | ||||||||||||||||||||||||||
128 | ||||||||||||||||||||||||||
129 | ||||||||||||||||||||||||||
130 | ||||||||||||||||||||||||||
131 | ||||||||||||||||||||||||||
132 | ||||||||||||||||||||||||||
133 | ||||||||||||||||||||||||||
134 | ||||||||||||||||||||||||||
135 | ||||||||||||||||||||||||||
136 | ||||||||||||||||||||||||||
137 | ||||||||||||||||||||||||||
138 | ||||||||||||||||||||||||||
139 | ||||||||||||||||||||||||||
140 | ||||||||||||||||||||||||||
141 | ||||||||||||||||||||||||||
142 | ||||||||||||||||||||||||||
143 |