44 lines
813 B
Python
44 lines
813 B
Python
from typing import Optional
|
|
from datetime import datetime
|
|
from ninja import Schema, ModelSchema
|
|
|
|
from noita.models import Objectiv
|
|
|
|
|
|
class ObjectivOut(ModelSchema):
|
|
class Meta:
|
|
model = Objectiv
|
|
fields = ["objectiv_id", "count"]
|
|
|
|
|
|
class NoitaSubmissionOut(Schema):
|
|
id: str
|
|
user_id: Optional[int]
|
|
username: Optional[str]
|
|
file_size: int
|
|
content_type: str
|
|
created_at: datetime
|
|
processed: bool
|
|
|
|
|
|
class ObjectivResultOut(Schema):
|
|
objectiv_id: str
|
|
count: int
|
|
points_per_objectiv: int
|
|
total_points: int
|
|
|
|
|
|
class ResultsOut(Schema):
|
|
total_score: int
|
|
objectives: list[ObjectivResultOut]
|
|
|
|
|
|
class LeaderboardEntryOut(Schema):
|
|
rank: int
|
|
username: str
|
|
total_score: int
|
|
|
|
|
|
class LeaderboardOut(Schema):
|
|
leaderboard: list[LeaderboardEntryOut]
|