fix parameter path
This commit is contained in:
parent
2dedf30095
commit
340b3e4b52
@ -1,4 +1,4 @@
|
|||||||
from fastapi import APIRouter, Depends
|
from fastapi import APIRouter, Depends, HTTPException, status
|
||||||
from ..dependencies import users_active, permissions_checker, database
|
from ..dependencies import users_active, permissions_checker, database
|
||||||
from ..models import users
|
from ..models import users
|
||||||
from typing import Annotated
|
from typing import Annotated
|
||||||
@ -7,11 +7,11 @@ from typing import Annotated
|
|||||||
router = APIRouter()
|
router = APIRouter()
|
||||||
|
|
||||||
@router.get("/users", tags=["users"], response_model=list[users.UserOut])
|
@router.get("/users", tags=["users"], response_model=list[users.UserOut])
|
||||||
async def read_users(skip : int = 0, limit : int = 20, authorize: Annotated[bool, Depends(permissions_checker.PermissionChecker(roles=["Admin"]))]):
|
async def read_users(authorize: Annotated[bool, Depends(permissions_checker.PermissionChecker(roles=["Admin"]))], skip: int = 0, limit: int = 20):
|
||||||
if limit < 1 or skip < 0:
|
if limit < 1 or skip < 0 or limit < skip:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=status.HTTP_400_BAD_REQUEST,
|
status_code=status.HTTP_400_BAD_REQUEST,
|
||||||
detail="skip should be greater than 0 and limit should be greater than 1"
|
detail="skip should be greater than 0 and limit should be greater than 1. Limit should be greater than skip"
|
||||||
)
|
)
|
||||||
limit = limit + skip
|
limit = limit + skip
|
||||||
listUsers = []
|
listUsers = []
|
||||||
|
Loading…
x
Reference in New Issue
Block a user