update. 初步完成用户管理接口
This commit is contained in:
+47
-1
@@ -2,7 +2,53 @@
|
||||
from datetime import datetime
|
||||
from typing import List, Optional
|
||||
|
||||
from ninja import Schema
|
||||
from ninja import Schema, ModelSchema
|
||||
|
||||
from users.models import User
|
||||
|
||||
|
||||
# ========== 用户 Schema ==========
|
||||
|
||||
|
||||
class UserOut(Schema):
|
||||
id: int
|
||||
username: str
|
||||
cname: Optional[str] = None
|
||||
phone: Optional[str] = None
|
||||
email: Optional[str] = None
|
||||
avatar: Optional[str] = None
|
||||
|
||||
# dept: Optional[int] = None
|
||||
# roles: List[int] = []
|
||||
|
||||
is_active: bool
|
||||
is_staff: bool
|
||||
is_superuser: bool
|
||||
|
||||
last_login: Optional[datetime] = None
|
||||
date_joined: datetime
|
||||
|
||||
|
||||
class UserCreate(Schema):
|
||||
username: str
|
||||
password: str
|
||||
cname: Optional[str] = None
|
||||
phone: Optional[str] = None
|
||||
email: Optional[str] = None
|
||||
dept: Optional[int] = None
|
||||
roles: List[int] = []
|
||||
is_active: bool = True
|
||||
|
||||
|
||||
class UserUpdate(Schema):
|
||||
username: Optional[str]
|
||||
password: Optional[str]
|
||||
cname: Optional[str]
|
||||
phone: Optional[str]
|
||||
email: Optional[str]
|
||||
dept: Optional[int]
|
||||
roles: Optional[List[int]]
|
||||
is_active: Optional[bool]
|
||||
|
||||
|
||||
# ========== 菜单 Schema ==========
|
||||
|
||||
Reference in New Issue
Block a user