2023-11-03 13:10:22 +03:00
|
|
|
import time
|
2023-11-22 19:38:39 +03:00
|
|
|
|
2024-10-31 19:48:06 +03:00
|
|
|
from sqlalchemy import JSON, Boolean, Column, ForeignKey, Integer, String
|
2023-11-22 19:38:39 +03:00
|
|
|
|
2023-10-23 17:51:13 +03:00
|
|
|
from services.db import Base
|
2024-02-21 10:27:16 +03:00
|
|
|
|
2022-09-03 13:50:14 +03:00
|
|
|
|
2022-07-21 14:58:50 +03:00
|
|
|
class TopicFollower(Base):
|
2024-04-17 18:32:23 +03:00
|
|
|
__tablename__ = "topic_followers"
|
2021-08-20 12:27:19 +03:00
|
|
|
|
2022-09-03 13:50:14 +03:00
|
|
|
id = None # type: ignore
|
2024-04-17 18:32:23 +03:00
|
|
|
follower = Column(Integer, ForeignKey("author.id"), primary_key=True)
|
|
|
|
topic = Column(Integer, ForeignKey("topic.id"), primary_key=True)
|
2024-02-23 21:22:55 +03:00
|
|
|
created_at = Column(Integer, nullable=False, default=int(time.time()))
|
2022-09-18 17:29:21 +03:00
|
|
|
auto = Column(Boolean, nullable=False, default=False)
|
2021-08-20 11:08:32 +03:00
|
|
|
|
2024-02-24 13:22:35 +03:00
|
|
|
|
2022-09-03 13:50:14 +03:00
|
|
|
class Topic(Base):
|
2024-04-17 18:32:23 +03:00
|
|
|
__tablename__ = "topic"
|
2021-12-12 16:00:38 +03:00
|
|
|
|
2024-02-19 17:22:38 +03:00
|
|
|
slug = Column(String, unique=True)
|
2024-04-17 18:32:23 +03:00
|
|
|
title = Column(String, nullable=False, comment="Title")
|
|
|
|
body = Column(String, nullable=True, comment="Body")
|
|
|
|
pic = Column(String, nullable=True, comment="Picture")
|
|
|
|
community = Column(ForeignKey("community.id"), default=1)
|
|
|
|
oid = Column(String, nullable=True, comment="Old ID")
|
2024-10-21 12:15:44 +03:00
|
|
|
|
2024-10-31 19:48:06 +03:00
|
|
|
parent_ids = Column(JSON, nullable=True, comment="Parent Topic IDs")
|