This repository has been archived by the owner on Dec 23, 2023. It is now read-only.
/
types.go
47 lines (41 loc) · 1.49 KB
/
types.go
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
package plan
import "time"
type (
// User is the top level struct for, you guessed it, user data.
// The data is stored in an object database, so purchases
// Are stored as a property on the user, rather than by association.
User struct {
Email string `json:"email"`
Saved int64 `json:"saved,omitempty"`
Contributions int64 `json:"contributions,omitempty"`
Frequency Frequency `json:"frequency,omitempty"`
LastPaycheck *time.Time `json:"lastPaycheck,omitempty"`
Purchases []Purchase `json:"purchases,omitempty"`
}
// Purchase is something a User wants to buy.
Purchase struct {
ID string `json:"id"`
Deleted bool `json:"deleted"`
Purchased bool `json:"purchased"`
PurchasedAt *time.Time `json:"purchasedAt"`
Date *time.Time `json:"date"`
Product Product `json:"product"`
Quantity int64 `json:"quantity"`
}
// Product contains information about the thing a User wants to buy.
Product struct {
Name string `datastore:",noindex" json:"name"`
Description string `datastore:",noindex" json:"description"`
Price int64 `json:"price"`
URL string `json:"url"`
Image string `json:"image"`
OriginalImage string `datastore:",noindex" json:"originalImage"`
}
Frequency string
)
const (
Weekly Frequency = "Every Week"
Biweekly = "Every 2 Weeks"
Monthly = "Once A Month"
TwiceMonthly = "1st and 15th"
)