We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5373286 commit 98c78e4Copy full SHA for 98c78e4
1 file changed
backend/app/api/routes/items.py
@@ -17,13 +17,18 @@ def read_items(
17
Retrieve items.
18
"""
19
20
- statment = select(func.count()).select_from(Item)
21
- count = session.exec(statment).one()
22
-
23
if current_user.is_superuser:
+ statment = select(func.count()).select_from(Item)
+ count = session.exec(statment).one()
24
statement = select(Item).offset(skip).limit(limit)
25
items = session.exec(statement).all()
26
else:
+ statment = (
27
+ select(func.count())
28
+ .select_from(Item)
29
+ .where(Item.owner_id == current_user.id)
30
+ )
31
32
statement = (
33
select(Item)
34
.where(Item.owner_id == current_user.id)
0 commit comments