@anonymous/

PowderblueInsidiousCubase

Python

No description

fork
loading
Files
  • main.py
main.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
# models/participant.py
from message import Message
from message_reference import Message_Reference

class Participant(Base):
    __tablename__ = 'participant'

    uuid = Column(UUID, primary_key=True, default=uuid.uuid4)
    conference = Column(UUID, ForeignKey('conference.uuid'), nullable=False)
    user = Column(UUID, ForeignKey('user.uuid'), nullable=False)

    def messages(self):
        return session.query(Message).join(Message_Reference).filter(
            Message_Reference.user == self.user).all()


# models/message.py
class Message(ConcreteBase, Base):
    __tablename__ = 'message'

    uuid = Column(UUID, primary_key = True, default = uuid.uuid4)
    author = Column(UUID, nullable = False)
    readed = Column(BOOLEAN, nullable = False, default = False)
    date =  Column(TIMESTAMP(timezone = True), nullable = False, default = datetime.datetime.utcnow)

    __mapper_args__ = {
        'polymorphic_identity': 'message',
        'concrete': True
    }

class Text_Message(Message):
    __tablename__ = 'text_message'

    uuid = Column(UUID, primary_key = True, default = uuid.uuid4)
    author = Column(UUID, nullable = False)
    readed = Column(BOOLEAN, nullable = False, default = False)
    date =  Column(TIMESTAMP(timezone = True), nullable = False, default = datetime.datetime.utcnow)
    content = Column(TEXT, nullable = False)
    edited = Column(BOOLEAN, nullable = False, default = False)

    __mapper_args__ = {
        'polymorphic_identity': 'text_message',
        'concrete': True
    }