Добавил слип для теста

This commit is contained in:
urec56 2024-06-18 16:58:01 +05:00
parent 815bdd6704
commit 26699df626
2 changed files with 3 additions and 2 deletions

View file

@ -1,3 +1,5 @@
import asyncio
from fastapi import APIRouter, Depends, status from fastapi import APIRouter, Depends, status
from app.config import settings from app.config import settings
@ -28,6 +30,7 @@ router = APIRouter(prefix="/chat", tags=["Чат"])
response_model=SAllowedChats, response_model=SAllowedChats,
) )
async def get_all_chats(user: SUser = Depends(check_verificated_user_with_exc), uow=Depends(UnitOfWork)): async def get_all_chats(user: SUser = Depends(check_verificated_user_with_exc), uow=Depends(UnitOfWork)):
await asyncio.sleep(10)
async with uow: async with uow:
allowed_chats = await uow.user.get_user_allowed_chats(user.id) allowed_chats = await uow.user.get_user_allowed_chats(user.id)
return allowed_chats return allowed_chats

View file

@ -1,4 +1,3 @@
import asyncio
from random import randrange from random import randrange
from fastapi import APIRouter, Depends, status from fastapi import APIRouter, Depends, status
@ -166,7 +165,6 @@ async def login_user(user_data: SUserLogin, uow=Depends(UnitOfWork)):
response_model=SUserResponse, response_model=SUserResponse,
) )
async def get_user(current_user: SUser = Depends(get_current_user)): async def get_user(current_user: SUser = Depends(get_current_user)):
await asyncio.sleep(10)
return current_user return current_user