minor fixes

This commit is contained in:
2022-09-14 18:56:49 +03:00
parent e4a6735199
commit 6b4c00d9e7
3 changed files with 16 additions and 17 deletions

View File

@@ -10,7 +10,7 @@ from services.zine.shoutscache import ShoutsCache
@query.field("topicsAll")
async def topics_all(_, info):
async def topics_all(_, _info):
topics = await TopicStorage.get_topics_all()
for topic in topics:
topic.stat = await TopicStat.get_stat(topic.slug)

View File

@@ -11,7 +11,7 @@ from resolvers.topics import topic_follow, topic_unfollow
from resolvers.community import community_follow, community_unfollow
from resolvers.reactions import reactions_follow, reactions_unfollow
from auth.authenticate import login_required
from sqlalchemy import select, desc, and_
from sqlalchemy import select, desc, asc, and_
from sqlalchemy.orm import selectinload
@@ -42,7 +42,7 @@ async def top_overall(_, _info, offset, limit):
@query.field("recentPublished")
async def recent_published(_, _info, offset, limit):
async with ShoutsCache.lock:
return ShoutsCache.top_overall[offset : offset + limit]
return ShoutsCache.recent_published[offset : offset + limit]
@query.field("recentAll")
@@ -54,7 +54,7 @@ async def recent_all(_, _info, offset, limit):
@query.field("recentReacted")
async def recent_reacted(_, _info, offset, limit):
async with ShoutsCache.lock:
return ShoutsCache.recent_all[offset : offset + limit]
return ShoutsCache.recent_reacted[offset : offset + limit]
@mutation.field("viewShout")
@@ -116,7 +116,7 @@ async def shouts_by_topics(_, _info, slugs, offset, limit):
session.query(Shout)
.join(ShoutTopic)
.where(and_(ShoutTopic.topic.in_(slugs), bool(Shout.publishedAt)))
.order_by(desc(Shout.publishedAt))
.order_by(asc(Shout.publishedAt))
.limit(limit)
.offset(offset)
)
@@ -134,7 +134,7 @@ async def shouts_by_collection(_, _info, collection, offset, limit):
session.query(Shout)
.join(ShoutCollection, ShoutCollection.collection == collection)
.where(and_(ShoutCollection.shout == Shout.slug, bool(Shout.publishedAt)))
.order_by(desc(Shout.publishedAt))
.order_by(asc(Shout.publishedAt))
.limit(limit)
.offset(offset)
)
@@ -151,7 +151,7 @@ async def shouts_by_authors(_, _info, slugs, offset, limit):
session.query(Shout)
.join(ShoutAuthor)
.where(and_(ShoutAuthor.user.in_(slugs), bool(Shout.publishedAt)))
.order_by(desc(Shout.publishedAt))
.order_by(asc(Shout.publishedAt))
.limit(limit)
.offset(offset)
)