from typing import List, Optional from pydantic import BaseModel class UsersBase(BaseModel): # 姓名 name: str # 用户名称 username: str # 密码明文 password: str class UsersCreate(UsersBase): class Config: schema_extra = { "example": { "name": "wangyixiao", "username": "xiaogeer", "password": "Hello123!" } } class LoginBase(BaseModel): username: str password: str class Config: schema_extra = { "example": { "username": "xiaogeer", "password": "Hello123!" } } class AddUsersToProject(BaseModel): project_id: int user_ids: List[int] class Config: schema_extra = { "example": { "project_id": 1, "user_ids": [3,4] } } class RemoveUsersToProject(BaseModel): project_id: int user_id: int class Config: schema_extra = { "example": { "project_id": 1, "user_id": 4 } } class SetUserToAdmin(BaseModel): project_id: int user_id: int class Config: schema_extra = { "example": { "project_id": 1, "user_id": 3 } }