mirror of
https://github.com/flibusta-apps/book_library_server.git
synced 2026-03-03 15:10:51 +01:00
Add random caching
This commit is contained in:
@@ -54,8 +54,12 @@ async def create_author(data: CreateAuthor):
|
||||
|
||||
|
||||
@author_router.get("/random", response_model=Author)
|
||||
async def get_random_author(allowed_langs: frozenset[str] = Depends(get_allowed_langs)):
|
||||
author_id = await GetRandomAuthorService.get_random_id(allowed_langs)
|
||||
async def get_random_author(
|
||||
request: Request, allowed_langs: frozenset[str] = Depends(get_allowed_langs)
|
||||
):
|
||||
author_id = await GetRandomAuthorService.get_random_id(
|
||||
allowed_langs, request.app.state.redis
|
||||
)
|
||||
|
||||
return (
|
||||
await AuthorDB.objects.select_related(SELECT_RELATED_FIELDS)
|
||||
|
||||
Reference in New Issue
Block a user