示例#1
0
async def get_task_status(
    user_id: int,
    task_id: str,
    authorized_user: User = Depends(check_authorization)
) -> TaskResponse:
    check_user(user_id, authorized_user.id)
    return await PostsDAL.get_task_status(task_id)
示例#2
0
async def unsubscribe(
    user_id: int,
    another_user: UserId,
    user: OutUser = Depends(check_authorization)) -> Any:
    check_user(user_id, user.id)
    return await UsersDataAccessLayer.unsubscribe(
        user_id=user.id, want_unsubscribe_on_user_with_id=another_user.user_id)
示例#3
0
async def get_feed(
    user_id: int,
    page: int,
    size: int,
    user: OutUser = Depends(check_authorization)) -> Any:
    check_user(user_id, user.id)
    return await UsersDataAccessLayer.get_feed(user_id=user_id,
                                               page=page,
                                               size=size)
示例#4
0
async def add_post(
    user_id: int,
    post: InPost,
    authorized_user: User = Depends(check_authorization)
) -> Union[JSONResponse, TaskResponse]:
    '''
    Отдает задачу на обработку
    '''
    check_user(user_id, authorized_user.id)
    return await PostsDAL.add_post(user_id, post)
示例#5
0
async def subscribe(
    user_id: int,
    another_user: UserId,
    user: OutUser = Depends(check_authorization)
) -> Union[List[OutUser], JSONResponse]:
    '''
    Возвращает список подписок
    '''
    check_user(user_id, user.id)
    return await UsersDataAccessLayer.subscribe(
        user_id=user.id, want_subscribe_on_user_with_id=another_user.user_id)