-
Notifications
You must be signed in to change notification settings - Fork 0
/
model.py
76 lines (62 loc) · 2.84 KB
/
model.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
# Copyright (C) 2013 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Datastore models for M-Distance Project"""
__author__ = '[email protected] (Alexander Sova)'
from google.appengine.ext import db
from oauth2client.appengine import CredentialsProperty
class Credentials(db.Model):
"""Datastore entity for storing OAuth2.0 credentials.
The CredentialsProperty is provided by the Google API Python Client, and is
used by the Storage classes to store OAuth 2.0 credentials in the data store.
"""
credentials = CredentialsProperty()
class OAuthRequestToken(db.Model):
"""Datastore entity for storing OAuth1 Request Token for Fitbit."""
request_token = db.StringProperty()
request_token_secret = db.StringProperty()
verifier = db.StringProperty()
access_token = db.StringProperty()
access_token_secret = db.StringProperty()
created = db.DateTimeProperty(auto_now_add=True)
class Preferences(db.Model):
"""Datastore entity for storing user preferences."""
hourly_updates = db.BooleanProperty(default=True)
goal_updates = db.BooleanProperty(default=True)
battery_level = db.BooleanProperty(default=True)
class FitbitGoals(db.Model):
"""Datastore entity for storing daily Fitbit goals."""
steps = db.IntegerProperty(default=10000)
floors = db.IntegerProperty(default=10)
distance = db.FloatProperty(default=8.05) #in km
caloriesOut = db.IntegerProperty(default=2500)
activeMinutes = db.IntegerProperty(default=30)
class FitbitGoalsReported(db.Model):
"""Datastore entity for storing daily Fitbit goals."""
steps = db.BooleanProperty(default=False)
floors = db.BooleanProperty(default=False)
distance = db.BooleanProperty(default=False)
caloriesOut = db.BooleanProperty(default=False)
activeMinutes = db.BooleanProperty(default=False)
class FitbitStats(db.Model):
"""Datastore entity for storing latest Fitbit activity statistics."""
steps = db.IntegerProperty(default=0, indexed=True)
floors = db.IntegerProperty(default=0)
distance = db.FloatProperty(default=0.0) #in km
caloriesOut = db.IntegerProperty(default=0)
activeMinutes = db.IntegerProperty(default=0)
reported = db.BooleanProperty(default=False, indexed=True)
last_modifieed = db.DateTimeProperty(auto_now=True)
class GlassTimelineItem(db.Model):
"""Datastore entity for info about last card inserted to Glass."""
item_id = db.StringProperty()