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