This commit is contained in:
parent
a05072fd71
commit
f04e20426f
|
@ -9,12 +9,11 @@ class TopicFollower(Base):
|
||||||
__tablename__ = 'topic_followers'
|
__tablename__ = 'topic_followers'
|
||||||
|
|
||||||
id = None # type: ignore
|
id = None # type: ignore
|
||||||
follower = Column(ForeignKey('author.id'), primary_key=True)
|
follower = Column(Integer, ForeignKey('author.id'), primary_key=True)
|
||||||
topic = Column(ForeignKey('topic.id'), primary_key=True)
|
topic = Column(Integer, ForeignKey('topic.id'), primary_key=True)
|
||||||
created_at = Column(Integer, nullable=False, default=lambda: int(time.time()))
|
created_at = Column(Integer, nullable=False, default=int(time.time()))
|
||||||
auto = Column(Boolean, nullable=False, default=False)
|
auto = Column(Boolean, nullable=False, default=False)
|
||||||
|
|
||||||
|
|
||||||
class Topic(Base):
|
class Topic(Base):
|
||||||
__tablename__ = 'topic'
|
__tablename__ = 'topic'
|
||||||
|
|
||||||
|
|
|
@ -191,7 +191,7 @@ def author_follows_topics(author_id: int):
|
||||||
subquery_topic_followers = (
|
subquery_topic_followers = (
|
||||||
select(
|
select(
|
||||||
[
|
[
|
||||||
TopicFollower.topic,
|
TopicFollower.topic_id,
|
||||||
func.count(distinct(TopicFollower.follower)).label('followers_stat'),
|
func.count(distinct(TopicFollower.follower)).label('followers_stat'),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user