Skip to content

Commit

Permalink
feat: adding docstring to leaderboard serializer and crud
Browse files Browse the repository at this point in the history
  • Loading branch information
ussyalfaks committed Jan 27, 2025
1 parent fc818e6 commit 38c4ab8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
13 changes: 13 additions & 0 deletions web_app/api/serializers/leaderboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,23 @@
router = APIRouter()

class UserLeaderboardItem(BaseModel):
"""
Args:
db (Session): Database session dependency.
Returns:
UserLeaderboardResponse: Response containing the leaderboard data.
"""
wallet_id: str
positions_number: int

class UserLeaderboardResponse(BaseModel):
"""
UserLeaderboardResponse is a model representing the response for a user leaderboard.
Attributes:
leaderboard (List[UserLeaderboardItem]): A list of user leaderboard items.
"""
leaderboard: List[UserLeaderboardItem]

@router.get(
Expand Down
9 changes: 9 additions & 0 deletions web_app/db/crud/leaderborad.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,16 @@
logger = logging.getLogger(__name__)

class LeaderboardCRUD:
"""
A class used to perform CRUD operations related to the leaderboard.
"""
def __init__(self, session: Session):
"""
Initializes a new instance of the class.
Args:
session (Session): The database session to be used for database operations.
"""
self.Session = session

def get_top_users_by_positions(self) -> list[dict]:
Expand Down

0 comments on commit 38c4ab8

Please sign in to comment.