add limit and skip

This commit is contained in:
Valentin CZERYBA 2023-10-13 23:36:51 +02:00
parent d7e9477572
commit 170f66ce26

View File

@ -10,7 +10,7 @@ router = APIRouter()
async def read_users(authorize: Annotated[bool, Depends(permissions_checker.PermissionChecker(roles=["Admin"]))]): async def read_users(authorize: Annotated[bool, Depends(permissions_checker.PermissionChecker(roles=["Admin"]))]):
listUsers = [] listUsers = []
user_repository = users.UserRepository(database=database.database) user_repository = users.UserRepository(database=database.database)
for fake in user_repository.find_by({}): for fake in user_repository.find_by({}, limit=20, skip=0):
print(fake) print(fake)
user = users.UserOut(id=fake.id, username=fake.username, disabled=fake.disabled, roles=fake.roles) user = users.UserOut(id=fake.id, username=fake.username, disabled=fake.disabled, roles=fake.roles)
listUsers.append(user) listUsers.append(user)