imports-format+id-fix+remigrate

This commit is contained in:
2022-11-10 08:40:32 +03:00
parent b62211e05f
commit 503d6daa93
11 changed files with 36 additions and 37 deletions

View File

@@ -58,6 +58,7 @@ class ShoutsCache:
)
.where(Shout.deletedAt.is_(None))
.filter(Shout.publishedAt.is_not(None))
.group_by(Shout.id)
.order_by(desc("publishedAt"))
# .limit(ShoutsCache.limit)
),
@@ -87,6 +88,7 @@ class ShoutsCache:
selectinload(Shout.topics)
)
.where(Shout.deletedAt.is_(None))
.group_by(Shout.id)
.order_by(desc("createdAt"))
# .limit(ShoutsCache.limit)
)
@@ -118,7 +120,7 @@ class ShoutsCache:
.join(Reaction)
.where(and_(Shout.deletedAt.is_(None), Shout.slug.in_(reacted_slugs)))
.filter(Shout.publishedAt.is_not(None))
.group_by(Shout.slug, "reactedAt")
.group_by(Shout.id, "reactedAt")
.order_by(desc("reactedAt"))
# .limit(ShoutsCache.limit)
)
@@ -150,7 +152,7 @@ class ShoutsCache:
)
.join(Reaction)
.where(and_(Shout.deletedAt.is_(None), Shout.slug.in_(commented_slugs)))
.group_by(Shout.slug, "reactedAt")
.group_by(Shout.id, "reactedAt")
.order_by(desc("reactedAt"))
# .limit(ShoutsCache.limit)
)
@@ -177,7 +179,7 @@ class ShoutsCache:
.join(Reaction, Reaction.kind == ReactionKind.LIKE)
.where(Shout.deletedAt.is_(None))
.filter(Shout.publishedAt.is_not(None))
.group_by(Shout.slug)
.group_by(Shout.id)
.order_by(desc("reacted"))
# .limit(ShoutsCache.limit)
),
@@ -203,7 +205,7 @@ class ShoutsCache:
.join(Reaction)
.where(Shout.deletedAt.is_(None))
.filter(Shout.publishedAt > month_ago)
.group_by(Shout.slug)
.group_by(Shout.id)
# .limit(ShoutsCache.limit)
),
)
@@ -231,7 +233,7 @@ class ShoutsCache:
.join(Reaction, func.length(Reaction.body) > 0)
.where(Shout.deletedAt.is_(None))
.filter(Shout.publishedAt > month_ago)
.group_by(Shout.slug)
.group_by(Shout.id)
.order_by(desc("commented"))
# .limit(ShoutsCache.limit)
),