Add 3 roles, settings for marathons
This commit is contained in:
@@ -12,16 +12,21 @@ class MarathonBase(BaseModel):
|
||||
class MarathonCreate(MarathonBase):
|
||||
start_date: datetime
|
||||
duration_days: int = Field(default=30, ge=1, le=365)
|
||||
is_public: bool = False
|
||||
game_proposal_mode: str = Field(default="all_participants", pattern="^(all_participants|organizer_only)$")
|
||||
|
||||
|
||||
class MarathonUpdate(BaseModel):
|
||||
title: str | None = Field(None, min_length=1, max_length=100)
|
||||
description: str | None = None
|
||||
start_date: datetime | None = None
|
||||
is_public: bool | None = None
|
||||
game_proposal_mode: str | None = Field(None, pattern="^(all_participants|organizer_only)$")
|
||||
|
||||
|
||||
class ParticipantInfo(BaseModel):
|
||||
id: int
|
||||
role: str = "participant"
|
||||
total_points: int
|
||||
current_streak: int
|
||||
drop_count: int
|
||||
@@ -37,9 +42,11 @@ class ParticipantWithUser(ParticipantInfo):
|
||||
|
||||
class MarathonResponse(MarathonBase):
|
||||
id: int
|
||||
organizer: UserPublic
|
||||
creator: UserPublic
|
||||
status: str
|
||||
invite_code: str
|
||||
is_public: bool
|
||||
game_proposal_mode: str
|
||||
start_date: datetime | None
|
||||
end_date: datetime | None
|
||||
participants_count: int
|
||||
@@ -51,10 +58,15 @@ class MarathonResponse(MarathonBase):
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class SetParticipantRole(BaseModel):
|
||||
role: str = Field(..., pattern="^(participant|organizer)$")
|
||||
|
||||
|
||||
class MarathonListItem(BaseModel):
|
||||
id: int
|
||||
title: str
|
||||
status: str
|
||||
is_public: bool
|
||||
participants_count: int
|
||||
start_date: datetime | None
|
||||
end_date: datetime | None
|
||||
|
||||
Reference in New Issue
Block a user