-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add registered user count & total pp earned APIs for new FE homepage (#6
- Loading branch information
Showing
7 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
from fastapi import APIRouter | ||
|
||
from . import authentication | ||
from . import overall_stats | ||
from . import users | ||
from . import user_stats | ||
|
||
public_router = APIRouter() | ||
|
||
public_router.include_router(authentication.router) | ||
public_router.include_router(overall_stats.router) | ||
public_router.include_router(users.router) | ||
public_router.include_router(user_stats.router) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from fastapi import APIRouter, Response | ||
from fastapi.responses import JSONResponse | ||
from app.usecases import user_stats, users | ||
|
||
|
||
router = APIRouter(tags=["(Public) Overall Stats API"]) | ||
|
||
|
||
@router.get("/public/api/v1/overall-stats/total-registered-users") | ||
async def fetch_total_registered_user_count() -> Response: | ||
response = await users.fetch_total_registered_user_count() | ||
return JSONResponse( | ||
content=response, | ||
status_code=200, | ||
) | ||
|
||
|
||
@router.get("/public/api/v1/overall-stats/global-all-time-pp-earned") | ||
async def get_global_all_time_pp_earned() -> Response: | ||
response = await user_stats.fetch_global_all_time_pp_earned() | ||
return JSONResponse( | ||
content=response, | ||
status_code=200, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
from pydantic import BaseModel | ||
|
||
|
||
class UserStats(BaseModel): | ||
ranked_score: int | ||
total_score: int | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters