diff options
Diffstat (limited to 'api/models.go')
-rw-r--r-- | api/models.go | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/api/models.go b/api/models.go new file mode 100644 index 0000000..0845d1d --- /dev/null +++ b/api/models.go | |||
@@ -0,0 +1,57 @@ | |||
1 | package main | ||
2 | |||
3 | import ( | ||
4 | "time" | ||
5 | "github.com/google/uuid" | ||
6 | ) | ||
7 | |||
8 | type Statistic struct { | ||
9 | ID int64 `json:"-"` | ||
10 | Date time.Time `json:"date"` | ||
11 | User User `json:"user"` | ||
12 | Quantity int `json:"quantity"` | ||
13 | } | ||
14 | |||
15 | type StatisticPost struct { | ||
16 | Date time.Time `json:"date"` | ||
17 | Quantity int64 `json:"quantity"` | ||
18 | UserID int64 `json:"user_id"` | ||
19 | } | ||
20 | |||
21 | type User struct { | ||
22 | ID int64 `json:"-"` | ||
23 | Name string `json:"name"` | ||
24 | UUID uuid.UUID `json:"uuid"` | ||
25 | Password string `json:"-"` | ||
26 | } | ||
27 | |||
28 | type Token struct { | ||
29 | ID int64 `json:"-"` | ||
30 | UserID int64 `json:"user_id"` | ||
31 | Token string `json:"token"` | ||
32 | CreatedAt time.Time `json:"created_at"` | ||
33 | ExpiredAt time.Time `json:"expired_at"` | ||
34 | } | ||
35 | |||
36 | type Preference struct { | ||
37 | ID int64 `json:"-"` | ||
38 | Color string `json:"color"` | ||
39 | UserID int64 `json:"-"` | ||
40 | Size Size `json:"size"` | ||
41 | } | ||
42 | |||
43 | type Size struct { | ||
44 | ID int64 `json:"-"` | ||
45 | Size int64 `json:"size"` | ||
46 | Unit string `json:"unit"` | ||
47 | } | ||
48 | |||
49 | type WeeklyStatistic struct { | ||
50 | Date string `json:"date"` | ||
51 | Total int64 `json:"total"` | ||
52 | } | ||
53 | |||
54 | type DailyUserTotals struct { | ||
55 | Name string `json:"name"` | ||
56 | Total int64 `json:"total"` | ||
57 | } \ No newline at end of file | ||