init
This commit is contained in:
0
app/schemas/__init__.py
Normal file
0
app/schemas/__init__.py
Normal file
41
app/schemas/hackathon.py
Normal file
41
app/schemas/hackathon.py
Normal file
@@ -0,0 +1,41 @@
|
||||
from datetime import datetime
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from app.schemas.user import UserRead
|
||||
|
||||
|
||||
class HackathonCreate(BaseModel):
|
||||
title: str
|
||||
description: str
|
||||
start_date: datetime
|
||||
end_date: datetime
|
||||
|
||||
|
||||
class HackathonRead(BaseModel):
|
||||
id: int
|
||||
title: str
|
||||
description: str
|
||||
start_date: datetime
|
||||
end_date: datetime
|
||||
organizer_id: int
|
||||
|
||||
|
||||
class HackathonReadWithOrganizer(HackathonRead):
|
||||
organizer: UserRead
|
||||
|
||||
|
||||
class ParticipantRegistration(BaseModel):
|
||||
hackathon_id: int
|
||||
|
||||
|
||||
class ParticipantRead(BaseModel):
|
||||
id: int
|
||||
user_id: int
|
||||
hackathon_id: int
|
||||
is_confirmed: bool
|
||||
user: UserRead
|
||||
|
||||
|
||||
class ParticipantConfirm(BaseModel):
|
||||
user_id: int
|
||||
27
app/schemas/submission.py
Normal file
27
app/schemas/submission.py
Normal file
@@ -0,0 +1,27 @@
|
||||
from datetime import datetime
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from app.schemas.team import TeamRead
|
||||
from app.schemas.task import TaskRead
|
||||
|
||||
|
||||
class SubmissionCreate(BaseModel):
|
||||
team_id: int
|
||||
task_id: int
|
||||
description: str
|
||||
file_url: str | None = None
|
||||
|
||||
|
||||
class SubmissionRead(BaseModel):
|
||||
id: int
|
||||
team_id: int
|
||||
task_id: int
|
||||
description: str
|
||||
file_url: str | None
|
||||
submitted_at: datetime
|
||||
|
||||
|
||||
class SubmissionReadWithDetails(SubmissionRead):
|
||||
team: TeamRead
|
||||
task: TaskRead
|
||||
25
app/schemas/task.py
Normal file
25
app/schemas/task.py
Normal file
@@ -0,0 +1,25 @@
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class TaskCreate(BaseModel):
|
||||
hackathon_id: int
|
||||
title: str
|
||||
description: str
|
||||
requirements: str
|
||||
evaluation_criteria: str
|
||||
|
||||
|
||||
class TaskRead(BaseModel):
|
||||
id: int
|
||||
hackathon_id: int
|
||||
title: str
|
||||
description: str
|
||||
requirements: str
|
||||
evaluation_criteria: str
|
||||
|
||||
|
||||
class TaskUpdate(BaseModel):
|
||||
title: str | None = None
|
||||
description: str | None = None
|
||||
requirements: str | None = None
|
||||
evaluation_criteria: str | None = None
|
||||
31
app/schemas/team.py
Normal file
31
app/schemas/team.py
Normal file
@@ -0,0 +1,31 @@
|
||||
from pydantic import BaseModel
|
||||
|
||||
from app.schemas.user import UserRead
|
||||
|
||||
|
||||
class TeamCreate(BaseModel):
|
||||
name: str
|
||||
hackathon_id: int
|
||||
|
||||
|
||||
class TeamRead(BaseModel):
|
||||
id: int
|
||||
name: str
|
||||
hackathon_id: int
|
||||
|
||||
|
||||
class TeamMemberAdd(BaseModel):
|
||||
user_id: int
|
||||
role: str = "participant"
|
||||
|
||||
|
||||
class TeamMemberRead(BaseModel):
|
||||
id: int
|
||||
user_id: int
|
||||
team_id: int
|
||||
role: str
|
||||
user: UserRead
|
||||
|
||||
|
||||
class TeamReadWithMembers(TeamRead):
|
||||
members: list[TeamMemberRead]
|
||||
37
app/schemas/user.py
Normal file
37
app/schemas/user.py
Normal file
@@ -0,0 +1,37 @@
|
||||
from pydantic import BaseModel, EmailStr
|
||||
|
||||
|
||||
class UserCreate(BaseModel):
|
||||
name: str
|
||||
email: str
|
||||
phone: str | None = None
|
||||
password: str
|
||||
is_organizer: bool = False
|
||||
|
||||
|
||||
class UserRead(BaseModel):
|
||||
id: int
|
||||
name: str
|
||||
email: str
|
||||
phone: str | None
|
||||
is_organizer: bool
|
||||
|
||||
|
||||
class UserUpdate(BaseModel):
|
||||
name: str | None = None
|
||||
phone: str | None = None
|
||||
|
||||
|
||||
class PasswordChange(BaseModel):
|
||||
old_password: str
|
||||
new_password: str
|
||||
|
||||
|
||||
class Token(BaseModel):
|
||||
access_token: str
|
||||
token_type: str = "bearer"
|
||||
|
||||
|
||||
class LoginRequest(BaseModel):
|
||||
email: str
|
||||
password: str
|
||||
Reference in New Issue
Block a user