-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathtypes.ts
296 lines (280 loc) · 5.97 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
import Stripe from "stripe"
export interface UserDetails {
id: string
first_name: string
last_name: string
full_name?: string
avatar_url?: string
billing_address?: Stripe.Address
payment_method?: Stripe.PaymentMethod[Stripe.PaymentMethod.Type]
}
export interface Product {
id: string
active?: boolean
name?: string
description?: string
image?: string
metadata?: Stripe.Metadata
}
export interface Price {
id: string
product_id?: string
active?: boolean
description?: string
unit_amount?: number
currency?: string
type?: Stripe.Price.Type
interval?: Stripe.Price.Recurring.Interval
interval_count?: number
trial_period_days?: number | null
metadata?: Stripe.Metadata
products?: Product
}
export interface Customer {
id: string
stripe_customer_id?: string
}
export interface UserDetails {
id: string
first_name: string
last_name: string
full_name?: string
avatar_url?: string
billing_address?: Stripe.Address
payment_method?: Stripe.PaymentMethod[Stripe.PaymentMethod.Type]
}
export interface ProductWithPrice extends Product {
prices?: Price[]
}
export interface Subscription {
id: string
user_id: string
status?: Stripe.Subscription.Status
metadata?: Stripe.Metadata
price_id?: string
quantity?: number
cancel_at_period_end?: boolean
created: string
current_period_start: string
current_period_end: string
ended_at?: string
cancel_at?: string
canceled_at?: string
trial_start?: string
trial_end?: string
prices?: Price
}
export interface IngredientServingSize {
units: string
desc?: string
qty: number
grams?: number
scale: number
}
export interface Ingredient {
name: string
servingSize: IngredientServingSize
}
export interface ServingSize {
scale: number
qty: number
grams: number
units: string
originalWeight?: number
originalWeightUnits?: string
}
export interface Nutrients {
caloriesKCal: number
caloriesKJ: number
totalCarbs: number
diabetesCarbsADA: number
netCarbs: number
diabetesCarbs: number
fiber: number
starch: number
sugar: number
addedSugar: number
sugarAlcohols: number
protein: number
fat: number
transFat: number
monousatFat: number
polyunsatFat: number
omega3Fat: number
omega6Fat: number
saturatedFat: number
cholesterol: number
vitaminA: number
vitaminC: number
vitaminD: number
vitaminE: number
vitaminK: number
vitaminB1: number
vitaminB2: number
vitaminB3: number
vitaminB5: number
vitaminB6: number
vitaminB12: number
potassium: number
magnesium: number
calcium: number
iron: number
zinc: number
copper: number
phosphorus: number
sodium: number
selenium: number
folate: number
choline: number
alcohol: number
caffeine: number
gluten: number
manganese: number
conjugatedLinoleicAcid: number
phyticAcid: number
xylitol: number
isomalt: number
sorbitol: number
maltitol: number
lactitol: number
erythritol: number
pinitol: number
inositol: number
mannitol: number
}
export interface Nutrients {
[key: string]: number
}
export interface Recipe {
id: string
name: string
tags: string[]
description: string
prepareTime: number
cookTime: number
ingredients: Ingredient[]
steps: string[]
servings: number
servingSizes: ServingSize[]
nutrients: Nutrients
image?: string
}
export type Recipes = Recipe[]
export const nutrientUnits: { [key: string]: string } = {
caloriesKCal: "kcal",
caloriesKJ: "kJ",
totalCarbs: "g",
diabetesCarbsADA: "g",
netCarbs: "g",
diabetesCarbs: "g",
fiber: "g",
starch: "g",
sugar: "g",
addedSugar: "g",
sugarAlcohols: "g",
protein: "g",
fat: "g",
transFat: "g",
monousatFat: "g",
polyunsatFat: "g",
omega3Fat: "g",
omega6Fat: "g",
saturatedFat: "g",
cholesterol: "mg",
vitaminA: "IU",
vitaminC: "mg",
vitaminD: "IU",
vitaminE: "mg",
vitaminK: "mcg",
vitaminB1: "mg",
vitaminB2: "mg",
vitaminB3: "mg",
vitaminB5: "mg",
vitaminB6: "mg",
vitaminB12: "mcg",
potassium: "mg",
magnesium: "mg",
calcium: "mg",
iron: "mg",
zinc: "mg",
copper: "mg",
phosphorus: "mg",
sodium: "mg",
selenium: "mcg",
folate: "mcg",
choline: "mg",
alcohol: "g",
caffeine: "mg",
gluten: "mg",
manganese: "mg",
conjugatedLinoleicAcid: "mg",
phyticAcid: "mg",
xylitol: "g",
isomalt: "g",
sorbitol: "g",
maltitol: "g",
lactitol: "g",
erythritol: "g",
pinitol: "g",
inositol: "g",
mannitol: "g",
}
export const nutrientNames: { [key: string]: string } = {
caloriesKCal: "Calories (kCal)",
caloriesKJ: "Calories (kJ)",
totalCarbs: "Total Carbohydrates",
diabetesCarbsADA: "Diabetes Carbohydrates (ADA)",
netCarbs: "Net Carbohydrates",
diabetesCarbs: "Diabetes Carbohydrates",
fiber: "Fiber",
starch: "Starch",
sugar: "Sugar",
addedSugar: "Added Sugar",
sugarAlcohols: "Sugar Alcohols",
protein: "Protein",
fat: "Fat",
transFat: "Trans fat",
monousatFat: "Monounsaturated fat",
polyunsatFat: "Polyunsaturated fat",
omega3Fat: "Omega-3 fatty acids",
omega6Fat: "Omega-6 fatty acids",
saturatedFat: "Saturated fat",
cholesterol: "Cholesterol",
vitaminA: "Vitamin A",
vitaminC: "Vitamin C",
vitaminD: "Vitamin D",
vitaminE: "Vitamin E",
vitaminK: "Vitamin K",
vitaminB1: "Vitamin B1",
vitaminB2: "Vitamin B2",
vitaminB3: "Vitamin B3",
vitaminB5: "Vitamin B5",
vitaminB6: "Vitamin B6",
vitaminB12: "Vitamin B12",
potassium: "Potassium",
magnesium: "Magnesium",
calcium: "Calcium",
iron: "Iron",
zinc: "Zinc",
copper: "Copper",
phosphorus: "Phosphorus",
sodium: "Sodium",
selenium: "Selenium",
folate: "Folate",
choline: "Choline",
alcohol: "Alcohol",
caffeine: "Caffeine",
gluten: "Gluten",
manganese: "Manganese",
conjugatedLinoleicAcid: "Conjugated linoleic acid (CLA)",
phyticAcid: "Phytic acid",
xylitol: "Xylitol",
isomalt: "Isomalt",
sorbitol: "Sorbitol",
maltitol: "Maltitol",
lactitol: "Lactitol",
erythritol: "Erythritol",
pinitol: "Pinitol",
inositol: "Inositol",
mannitol: "Mannitol",
}