forked from comcomUBA/dcubabot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
models.py
70 lines (44 loc) · 1.29 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
#!/usr/bin/python3
# -*- coding: utf-8 -*-
from pony.orm import *
import datetime
db = Database()
class Command(db.Entity):
name = Required(str)
description = Optional(str)
enabled = Required(bool, default=True)
class SentMessage(db.Entity):
command = Required(str)
chat_id = Required(int, size=64)
message_id = Required(int, size=64)
timestamp = Required(datetime.datetime, default=datetime.datetime.utcnow)
class Listable(db.Entity):
name = Required(str)
url = Required(str)
chat_id = Optional(int, size=64)
validated = Required(bool, default=False)
class Obligatoria(Listable):
cubawiki_url = Optional(str)
class Optativa(Listable):
pass
class ECI(Listable):
pass
class Otro(Listable):
pass
# TODO: Subclasificar con validable
class Noticia(db.Entity):
text = Required(str)
date = Required(datetime.date, default=datetime.date.today())
validado = Required(bool, default=True)
class Noitip(db.Entity):
text = Required(str)
class AsmInstruction(db.Entity):
mnemonic = Required(str)
summary = Required(str)
url = Required(str)
class File(db.Entity):
path = Required(str)
file_id = Required(str)
def init_db(path):
db.bind('sqlite', path, create_db=True)
db.generate_mapping(create_tables=True)