-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdatabase.py
61 lines (49 loc) · 2.02 KB
/
database.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
from openedoo_project import db
from openedoo_project import config
class EclassSchema(db.Model):
"""Eclass database schema
:id integer: The Eclass id
:name varchar: The Eclass name
:course varchar: The course where Eclass belongs to
:university varchar: The university where Eclass belongs to
:privilege varchar: The Eclass privilege, public or private
"""
__tablename__ = 'eclass'
__table_args__ = {'extend_existing': True}
id = db.Column(db.Integer, primary_key=True, nullable=False)
name = db.Column(db.VARCHAR(50), nullable=False)
course = db.Column(db.VARCHAR(50))
university = db.Column(db.VARCHAR(50))
privilege = db.Column(db.VARCHAR(8), default="private")
class EclassPostsSchema(db.Model):
"""Eclass posts database schema.
:id integer: The Post id
:class_id integer: The Eclass id
:description text: The post's description
:reply text: The post's reply
:attachment text: The post's file attachment
:created datetime: Time when The post is created
:edited datetime: Time when The post is edited
"""
__tablename__ = 'eclass_discussion'
__table_args__ = {'extend_existing': True}
id = db.Column(db.Integer, primary_key=True, nullable=False)
class_id = db.Column(db.Integer, nullable=False)
description = db.Column(db.Text)
reply = db.Column(db.UnicodeText())
attachment = db.Column(db.Text)
created = db.Column(db.DateTime)
edited = db.Column(db.DateTime)
class EclassMemberSchema(db.Model):
"""Eclass member database schema.
:id integer: The membership id
:class_id integer: The eclass id
:user_id integer: The user id
:is_creator integer: (bool) The creator flag
"""
__tablename__ = 'eclass_member'
__table_args__ = {'extend_existing': True}
id = db.Column(db.Integer, primary_key=True, nullable=False)
class_id = db.Column(db.Integer, nullable=False)
user_id = db.Column(db.Integer, nullable=False)
is_creator = db.Column(db.SmallInteger, nullable=False, default=0)