Skip to content

Commit

Permalink
fix: add admin arg to crud.get_users
Browse files Browse the repository at this point in the history
  • Loading branch information
SaintShit committed Jul 15, 2024
1 parent 9e078f2 commit 500d770
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from config import DOCS, XRAY_SUBSCRIPTION_PATH

__version__ = "0.5.1"
__version__ = "0.5.2"


app = FastAPI(
Expand Down
4 changes: 4 additions & 0 deletions app/db/crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ def get_users(db: Session,
search: Optional[str] = None,
status: Optional[Union[UserStatus, list]] = None,
sort: Optional[List[UsersSortingOptions]] = None,
admin: Optional[Admin] = None,
admins: Optional[List[str]] = None,
reset_strategy: Optional[Union[UserDataLimitResetStrategy, list]] = None,
return_with_count: bool = False) -> Union[List[User], Tuple[List[User], int]]:
Expand All @@ -151,6 +152,9 @@ def get_users(db: Session,
else:
query = query.filter(User.data_limit_reset_strategy == reset_strategy)

if admin:
query = query.filter(User.admin == admin)

if admins:
query = query.filter(User.admin.has(Admin.username.in_(admins)))

Expand Down

0 comments on commit 500d770

Please sign in to comment.