-
Notifications
You must be signed in to change notification settings - Fork 1
/
schema.py
65 lines (51 loc) · 1.73 KB
/
schema.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
from pymongo import MongoClient
from pymodm import connect, fields, MongoModel, EmbeddedMongoModel
import credentials
class TwitterAccount(MongoModel):
"""
Schema for a twitter user
Properties:
phone_number -- note: will represent unique id
type: String
access_token -- access token
type: String
access_token_secret -- access token secret
type: String
api_key -- api key
type: String
api_secret_key -- api secret key
type: String
"""
access_token = fields.CharField(required=True)
access_token_secret = fields.CharField(required=True)
api_key = fields.CharField(required=True)
api_secret_key = fields.CharField(required=True)
last_msg = fields.BigIntegerField(required=False)
class MessengerAccount(MongoModel):
"""
Schema for a messenger user
Properties:
phone_number -- note: will represent unique id
type: String
email -- email
type: Email
password -- password
type: String
"""
email = fields.EmailField(required=True)
password = fields.CharField(required=True)
class User(MongoModel):
"""
Schema for a user
Properties:
phone_number -- note: will represent unique id
type: String
email -- email
type: Email
accounts -- List of accounts
type: List(Account)
"""
phone_number = fields.CharField(primary_key=True, required=True)
active = fields.CharField(required=True)
twitter_login = fields.EmbeddedDocumentField('TwitterAccount')
messenger_login = fields.EmbeddedDocumentField('MessengerAccount')