Skip to content

Commit

Permalink
Stub /ranking/player and /ranking/unit
Browse files Browse the repository at this point in the history
  • Loading branch information
MikuAuahDark committed Nov 23, 2024
1 parent 4bf2e08 commit 9617729
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 0 deletions.
1 change: 1 addition & 0 deletions npps4/game/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
from . import payment
from . import personalnotice
from . import profile
from . import ranking
from . import reward
from . import scenario
from . import secretbox
Expand Down
2 changes: 2 additions & 0 deletions npps4/game/models.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import pydantic


class UserData(pydantic.BaseModel):
user_id: int
name: str
level: int


class CenterUnitInfo(pydantic.BaseModel):
unit_id: int
level: int
Expand Down
69 changes: 69 additions & 0 deletions npps4/game/ranking.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import pydantic

from . import models
from .. import idol
from .. import util
from ..system import common
from ..system import reward
from ..system import user


class PageableMixin(pydantic.BaseModel):
page: int = 0


class RankingLiveRequest(PageableMixin):
live_difficulty_id: int


class RankingPlayerRequest(PageableMixin):
id: int = 0
term: int
daily_index: int


class RankingUserData(pydantic.BaseModel):
user_id: int
name: str
level: int


class RankingData(pydantic.BaseModel):
rank: int
score: int
user_data: models.UserData
center_unit_info: models.CenterUnitInfo
setting_award_id: int


class RankingResponse(common.TimestampMixin, PageableMixin):
rank: int | None
items: list[RankingData]
total_cnt: int
present_cnt: int


@idol.register("ranking", "live")
async def ranking_live(context: idol.SchoolIdolUserParams, request: RankingLiveRequest) -> RankingResponse:
current_user = await user.get_current(context)
util.stub("ranking", "live", request)
return RankingResponse(
page=request.page,
rank=None,
items=[],
total_cnt=0,
present_cnt=await reward.count_presentbox(context, current_user),
)


@idol.register("ranking", "player")
async def ranking_player(context: idol.SchoolIdolUserParams, request: RankingPlayerRequest) -> RankingResponse:
current_user = await user.get_current(context)
util.stub("ranking", "player", request)
return RankingResponse(
page=request.page,
rank=None,
items=[],
total_cnt=0,
present_cnt=await reward.count_presentbox(context, current_user),
)
Empty file added npps4/system/ranking.py
Empty file.

0 comments on commit 9617729

Please sign in to comment.