2021-08-20 08:08:32 +00:00
|
|
|
from datetime import datetime
|
2023-10-26 21:07:35 +00:00
|
|
|
|
2022-11-10 05:40:32 +00:00
|
|
|
from sqlalchemy import Boolean, Column, DateTime, ForeignKey, String
|
2022-09-17 18:12:14 +00:00
|
|
|
|
2023-10-26 21:07:35 +00:00
|
|
|
from base.orm import Base
|
|
|
|
|
2022-09-03 10:50:14 +00:00
|
|
|
|
2022-07-21 11:58:50 +00:00
|
|
|
class TopicFollower(Base):
|
2022-09-03 10:50:14 +00:00
|
|
|
__tablename__ = "topic_followers"
|
2021-08-20 09:27:19 +00:00
|
|
|
|
2023-10-30 21:00:55 +00:00
|
|
|
id = None
|
|
|
|
follower: Column = Column(ForeignKey("user.id"), primary_key=True, index=True)
|
|
|
|
topic: Column = Column(ForeignKey("topic.id"), primary_key=True, index=True)
|
|
|
|
createdAt = Column(DateTime, nullable=False, default=datetime.now, comment="Created at")
|
2022-09-18 14:29:21 +00:00
|
|
|
auto = Column(Boolean, nullable=False, default=False)
|
2021-08-20 08:08:32 +00:00
|
|
|
|
2021-12-12 09:44:54 +00:00
|
|
|
|
2022-09-03 10:50:14 +00:00
|
|
|
class Topic(Base):
|
|
|
|
__tablename__ = "topic"
|
2021-12-12 13:00:38 +00:00
|
|
|
|
2022-11-10 05:40:32 +00:00
|
|
|
slug = Column(String, unique=True)
|
2022-09-03 10:50:14 +00:00
|
|
|
title = Column(String, nullable=False, comment="Title")
|
|
|
|
body = Column(String, nullable=True, comment="Body")
|
|
|
|
pic = Column(String, nullable=True, comment="Picture")
|
2023-10-30 21:00:55 +00:00
|
|
|
community: Column = Column(ForeignKey("community.id"), default=1, comment="Community")
|
2022-09-03 10:50:14 +00:00
|
|
|
oid = Column(String, nullable=True, comment="Old ID")
|