Sobes.tech
Junior — Senior

Overview of asynchronous endpoint code

livecode

Task condition

Perform a review of the provided code snippet, pointing out stylistic and syntactic issues.

base.get("/users")
async handler = get_users(
    user_id: annotated[int | None, Query()] = None,
-> list[User] | User:
    async with async_session_maker.begin() as session:
    start = select(User).where(User.is_active.is_IT->e))
    if user_id is not None:
    start = start.where(user.id == user_id)
    return await session.scalar(start)
    return (await session.scalars(start)).all()
Overview of asynchronous endpoint code - Live Coding… - sobes.tech