This commit is contained in:
parent
f5ebd0ada9
commit
626e899ca3
|
@ -101,11 +101,13 @@ async def get_cached_topic_by_slug(slug: str, get_with_stat):
|
||||||
with local_session() as session:
|
with local_session() as session:
|
||||||
topic_query = select(Topic).filter(Topic.slug == slug)
|
topic_query = select(Topic).filter(Topic.slug == slug)
|
||||||
result = get_with_stat(session.execute(topic_query))
|
result = get_with_stat(session.execute(topic_query))
|
||||||
if result:
|
if isinstance(result, list) and len(result) > 0:
|
||||||
[topic] = result
|
[topic] = result
|
||||||
if topic:
|
elif isinstance(result, Topic):
|
||||||
await cache_topic(topic)
|
topic = result
|
||||||
return topic
|
if topic:
|
||||||
|
await cache_topic(topic)
|
||||||
|
return topic
|
||||||
|
|
||||||
|
|
||||||
async def get_cached_authors_by_ids(authors_ids: List[int]) -> List[Author | dict]:
|
async def get_cached_authors_by_ids(authors_ids: List[int]) -> List[Author | dict]:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user