547a4eeae6
* docs(requirements.txt):升级fastapi、uvicorn版本 * refactor(user):重构用户router、service * ref: role list api * doc: 1 * refactor(backend): mvc ref
20 lines
510 B
Python
20 lines
510 B
Python
from fastapi import APIRouter, WebSocket
|
|
|
|
from schemas import common as BaseSchema
|
|
from service import auth as AuthService
|
|
|
|
router = APIRouter(tags=["公共"])
|
|
|
|
|
|
LoginResult = BaseSchema.Response[BaseSchema.LoginResult]
|
|
|
|
|
|
@router.post("/login", summary="登录", response_model=LoginResult)
|
|
async def login(data: BaseSchema.LoginForm):
|
|
return await AuthService.user_login(data)
|
|
|
|
|
|
@router.websocket("/ws", name="系统信息")
|
|
async def get_system_info(ws: WebSocket):
|
|
await AuthService.system_info(ws)
|