Skip to content

Commit

Permalink
Add beatmapset count queries
Browse files Browse the repository at this point in the history
  • Loading branch information
Lekuruu committed Feb 27, 2024
1 parent 912ce42 commit 835ee4b
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions database/repositories/beatmapsets.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,25 @@ def search_extended(
.limit(limit) \
.all()

@session_wrapper
def fetch_count(
user_id: int,
session: Session | None = None
) -> int:
return session.query(DBBeatmapset) \
.filter(DBBeatmapset.creator_id == user_id) \
.count()

@session_wrapper
def fetch_ranked_count(
user_id: int,
session: Session | None = None
) -> int:
return session.query(DBBeatmapset) \
.filter(DBBeatmapset.creator_id == user_id) \
.filter(DBBeatmapset.status > 0) \
.count()

@session_wrapper
def update(
beatmapset_id: int,
Expand Down

0 comments on commit 835ee4b

Please sign in to comment.