-
Notifications
You must be signed in to change notification settings - Fork 0
/
model.go
42 lines (34 loc) · 1.4 KB
/
model.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
package ds
import "fmt"
const RoleAdmin = "admin"
type Demonstration struct {
Id string `json:"id" datastore:"id"`
Name string `json:"name" datastore:"name"`
}
type User struct {
Id string `json:"id" datastore:"id"`
Phone string `json:"phone" datastore:"phone"`
Name string `json:"name" datastore:"name"`
Preference string `json:"preference" datastore:"preference"`
Time int64 `json:"time" datastore:"time"`
Role string `json:"role" datastore:"role"`
}
type Volunteer struct {
UserId string `json:"user_id" datastore:"user_id"`
DemonstrationId string `json:"demonstration_id" datastore:"demonstration_id"`
Polygon string `json:"polygon" datastore:"polygon"`
Location string `json:"location" datastore:"location"`
Time int64 `json:"time" datastore:"time"`
}
type Observation struct {
Time int64 `json:"time" datastore:"time"`
User string `json:"user_id" datastore:"user_id"`
Demonstration string `json:"demonstration" datastore:"demonstration"`
Polygon string `json:"polygon" datastore:"polygon"`
Density float32 `json:"density" datastore:"density"`
Latitude float32 `json:"latitude" datastore:"latitude"`
Longitude float32 `json:"longitude" datastore:"longitude"`
}
func GetVolunteerId(demonstrationId string, userId string) string {
return fmt.Sprintf("%s$%s", demonstrationId, userId)
}