core/orm/shout.py

25 lines
982 B
Python
Raw Normal View History

from typing import List
from datetime import datetime
2021-08-07 16:14:20 +00:00
from sqlalchemy import Column, Integer, String, ForeignKey, DateTime
from orm import Permission
from orm.base import Base
class Shout(Base):
2021-08-07 16:14:20 +00:00
__tablename__ = 'shout'
2021-08-08 12:23:12 +00:00
slug: str = Column(String, primary_key=True)
2021-08-19 15:33:39 +00:00
org_id: int = Column(Integer, ForeignKey("organization.id"), nullable=False, comment="Organization")
author_id: int = Column(Integer, ForeignKey("user.id"), nullable = False, comment="Author")
2021-08-07 16:14:20 +00:00
body: str = Column(String, nullable=False, comment="Body")
createdAt: str = Column(DateTime, nullable=False, default = datetime.now, comment="Created at")
updatedAt: str = Column(DateTime, nullable=True, comment="Updated at")
2021-08-08 12:23:12 +00:00
replyTo: str = Column(ForeignKey("shout.slug"), nullable=True)
versionOf: str = Column(ForeignKey("shout.slug"), nullable=True)
tags: str = Column(String, nullable=True)
topics: str = Column(String, nullable=True)
views: int = Column(Integer, default=0)
2021-08-07 16:14:20 +00:00
# TODO: add all the fields