core/orm/topic.py
Untone e151034bab
Some checks failed
deploy / deploy (push) Failing after 1m43s
fix-imports
2023-10-23 17:51:13 +03:00

25 lines
890 B
Python

from datetime import datetime
from sqlalchemy import Boolean, Column, DateTime, ForeignKey, String
from services.db import Base
class TopicFollower(Base):
__tablename__ = "topic_followers"
id = None # type: ignore
follower = Column(ForeignKey("author.id"), primary_key=True, index=True)
topic = Column(ForeignKey("topic.id"), primary_key=True, index=True)
createdAt = Column(DateTime, nullable=False, default=datetime.now)
auto = Column(Boolean, nullable=False, default=False)
class Topic(Base):
__tablename__ = "topic"
slug = Column(String, unique=True)
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")