2021-08-20 08:08:32 +00:00
|
|
|
from datetime import datetime
|
2022-07-21 11:58:50 +00:00
|
|
|
from sqlalchemy import Column, String, ForeignKey, DateTime, JSON as JSONType
|
2022-08-11 05:53:14 +00:00
|
|
|
from base.orm import Base
|
2021-08-20 08:08:32 +00:00
|
|
|
|
2022-07-21 11:58:50 +00:00
|
|
|
class ShoutTopic(Base):
|
|
|
|
__tablename__ = 'shout_topic'
|
2021-10-28 10:42:34 +00:00
|
|
|
|
|
|
|
id = None
|
2022-07-21 11:58:50 +00:00
|
|
|
shout = Column(ForeignKey('shout.slug'), primary_key = True)
|
|
|
|
topic = Column(ForeignKey('topic.slug'), primary_key = True)
|
|
|
|
class TopicFollower(Base):
|
|
|
|
__tablename__ = "topic_followers"
|
|
|
|
|
|
|
|
id = None
|
|
|
|
follower = Column(ForeignKey('user.slug'), primary_key = True)
|
2021-12-12 09:44:54 +00:00
|
|
|
topic = Column(ForeignKey('topic.slug'), primary_key = True)
|
2021-10-28 10:42:34 +00:00
|
|
|
createdAt: str = Column(DateTime, nullable=False, default = datetime.now, comment="Created at")
|
2021-08-20 09:27:19 +00:00
|
|
|
|
2021-08-20 08:08:32 +00:00
|
|
|
class Topic(Base):
|
|
|
|
__tablename__ = 'topic'
|
|
|
|
|
2021-12-12 09:44:54 +00:00
|
|
|
id = None
|
|
|
|
|
|
|
|
slug: str = Column(String, primary_key = True)
|
2021-10-14 05:28:52 +00:00
|
|
|
title: str = Column(String, nullable=False, comment="Title")
|
|
|
|
body: str = Column(String, nullable=True, comment="Body")
|
|
|
|
pic: str = Column(String, nullable=True, comment="Picture")
|
2021-12-12 15:29:51 +00:00
|
|
|
children = Column(JSONType, nullable=True, default = [], comment="list of children topics")
|
2021-12-11 10:23:17 +00:00
|
|
|
community = Column(ForeignKey("community.slug"), nullable=False, comment="Community")
|
2022-07-07 13:55:13 +00:00
|
|
|
oid: str = Column(String, nullable=True, comment="Old ID")
|
2021-12-12 13:00:38 +00:00
|
|
|
|