core/orm/message.py

21 lines
682 B
Python
Raw Normal View History

from typing import List
2021-07-01 18:26:04 +00:00
from datetime import datetime
2021-07-01 18:26:04 +00:00
from sqlalchemy import Column, Integer, String, ForeignKey, DateTime
from orm import Permission
from orm.base import Base
class Message(Base):
__tablename__ = 'message'
2021-07-01 18:26:04 +00:00
author: int = Column(ForeignKey("user.id"), nullable=False, comment="Sender")
body: str = Column(String, nullable=False, comment="Body")
2021-07-01 18:26:04 +00:00
createdAt = Column(DateTime, nullable=False, default = datetime.now, comment="Created at")
updatedAt = Column(DateTime, nullable=True, comment="Updated at")
replyTo: int = Column(ForeignKey("message.id"), nullable=True, comment="Reply to")
2021-07-01 18:26:04 +00:00
# TODO: work in progress, udpate this code