chore: 将后端移动到 api/ 目录,准备合并为单仓库

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
xuyueandClaude Opus 5.5 committed 2026-10-26 16:01:25 +08:00
1 parent e172ffc0b3
commit 0591eda56f
244 files changed

No files matched your search

+53
View File
@@ -0,0 +1,53 @@
from typing import List
from ninja import Schema, ModelSchema
from pydantic import EmailStr, Field
from .models import User, RoleChoices
class UserListSchema(ModelSchema):
@classmethod
def get(cls, obj):
raw_password = obj.raw_password if obj.role != RoleChoices.SUPER else ""
return cls(
id=obj.id,
username=obj.username,
raw_password=raw_password,
role=obj.role,
date_joined=obj.date_joined,
last_login=obj.last_login,
is_active=obj.is_active,
)
class Meta:
model = User
fields = [
"id",
"username",
"raw_password",
"role",
"date_joined",
"last_login",
"is_active",
]
class UserRegistrationSchema(Schema):
username: str
email: EmailStr
password: str = Field(min_length=6, max_length=20)
class UserLoginSchema(Schema):
username: str
password: str
class BatchUsersIn(Schema):
names: List[str]
classname: str
class ClassStudentEntry(Schema):
name: str
username: str