added a user system

This commit is contained in:
2026-08-30 17:07:55 +08:00
parent 0b85a2ed57
commit 637101bcdb
13 changed files with 1082 additions and 20 deletions

View File

@@ -131,3 +131,53 @@ class AssessmentResult(BaseModel):
substitutions: List[TextSubstitution]
feedback: str
details: Dict[str, str] = Field(default_factory=dict)
class AuthRequest(BaseModel):
model_config = ConfigDict(extra="forbid")
username: str = Field(min_length=3, max_length=50, pattern=r"^[A-Za-z0-9_.-]+$")
password: str = Field(min_length=8, max_length=128)
class UserPublic(BaseModel):
id: str
username: str
nickname: str
created_at: datetime
class AuthResponse(BaseModel):
token: str
user: UserPublic
class CourseSummary(BaseModel):
video_hash: str
title: str
duration_ms: Optional[int] = None
language: Optional[str] = None
sentence_count: int = Field(ge=0)
stream_url: str
enrolled: bool
class UserResultSummary(BaseModel):
attempt_id: str
video_hash: str
course_title: str
sentence_index: int
sentence_text: str
overall_score: float = Field(ge=0, le=100)
passed: bool
created_at: datetime
class UserDubShareSummary(BaseModel):
share_id: str
video_hash: str
course_title: str
title: str
segment_count: int = Field(ge=0)
average_score: float = Field(ge=0, le=100)
created_at: datetime