diff --git a/backend/app/api/routes/items.py b/backend/app/api/routes/items.py index ddbe93e..e325e9b 100644 --- a/backend/app/api/routes/items.py +++ b/backend/app/api/routes/items.py @@ -17,13 +17,18 @@ def read_items( Retrieve items. """ - statment = select(func.count()).select_from(Item) - count = session.exec(statment).one() - if current_user.is_superuser: + statment = select(func.count()).select_from(Item) + count = session.exec(statment).one() statement = select(Item).offset(skip).limit(limit) items = session.exec(statement).all() else: + statment = ( + select(func.count()) + .select_from(Item) + .where(Item.owner_id == current_user.id) + ) + count = session.exec(statment).one() statement = ( select(Item) .where(Item.owner_id == current_user.id)