-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodels.py
104 lines (73 loc) · 3.38 KB
/
models.py
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
########## This is where the database models go ##########
from google.appengine.ext import ndb
class StationInfo(ndb.Model):
station_id = ndb.IntegerProperty(required=True)
name = ndb.StringProperty(required=True)
coordinates = ndb.GeoPtProperty(required=True)
stAddress1 = ndb.StringProperty(required=True)
stAddress2 = ndb.StringProperty(required=False)
class StationStatus(ndb.Model):
station_id = ndb.IntegerProperty(required=True)
availableDocks = ndb.IntegerProperty(required=True)
totalDocks = ndb.IntegerProperty(required=True)
statusKey = ndb.IntegerProperty(required=True)
availableBikes = ndb.IntegerProperty(required=True)
date_time = ndb.DateTimeProperty(required=True)
errors = ndb.IntegerProperty(required=True)
@classmethod
def by_id(cls, sid):
status = StationStatus.query(StationStatus.station_id == sid).get()
return status
class StatusInfo(ndb.Model):
statusValue = ndb.StringProperty(required=True)
statusKey = ndb.IntegerProperty(required=True)
class Totals(ndb.Model):
date_time = ndb.DateTimeProperty(required=True)
bikes = ndb.IntegerProperty(required=True)
docks = ndb.IntegerProperty(required=True)
errors = ndb.IntegerProperty(required=True)
class SystemStats(ndb.Model):
date = ndb.DateProperty(required=True)
trips = ndb.IntegerProperty(required=True) #5pm to #5pm
miles = ndb.IntegerProperty(required=True) #5pm to 5pm
miles_per_trip = ndb.FloatProperty(required=True)
cum_trips = ndb.IntegerProperty(required=True) #since launch
cum_miles = ndb.IntegerProperty(required=True) #since launch
signups = ndb.IntegerProperty(required=True) #annual pass
members = ndb.IntegerProperty(required=True) #annual pass
day_passes = ndb.IntegerProperty(required=False) #5pm to 5pm
week_passes = ndb.IntegerProperty(required=False) #5pm to 5pm
class Alert(ndb.Model):
email = ndb.StringProperty(required=False)
phone = ndb.IntegerProperty(required=False)
carrier = ndb.StringProperty(required=False)
start1 = ndb.IntegerProperty(required=False)
start2 = ndb.IntegerProperty(required=False)
start3 = ndb.IntegerProperty(required=False)
end1 = ndb.IntegerProperty(required=False)
end2 = ndb.IntegerProperty(required=False)
end3 = ndb.IntegerProperty(required=False)
time = ndb.TimeProperty(required=True)
# List of integers representing day of the week.
# As the convention in Python, 0 is Sunday and 6 is Saturday.
days = ndb.IntegerProperty(repeated=True)
confirmed = ndb.BooleanProperty(default=False)
class AlertLog(ndb.Model):
alert_id = ndb.IntegerProperty(required=False)
email = ndb.StringProperty(required=False)
phone = ndb.IntegerProperty(required=False)
carrier = ndb.StringProperty(required=False)
start1 = ndb.IntegerProperty(required=False)
start2 = ndb.IntegerProperty(required=False)
start3 = ndb.IntegerProperty(required=False)
end1 = ndb.IntegerProperty(required=False)
end2 = ndb.IntegerProperty(required=False)
end3 = ndb.IntegerProperty(required=False)
time = ndb.TimeProperty(required=True)
complete = ndb.BooleanProperty(required=True, default=False)
sent = ndb.DateTimeProperty(required=False)
class AdminEmail(ndb.Model):
email = ndb.StringProperty(required=True)
# this app uses the AdminEmail entity in the inboundmail.py file
# use this property to store the email address to which the app will forward inbound email traffic
# for best results, store only one email address. that's all this is configured to work with.