feat: add session auth api

This commit is contained in:
hailin
2026-07-01 14:05:40 +08:00
parent 7c4b66b832
commit 18319c1fc8
5 changed files with 220 additions and 0 deletions

View File

@@ -1 +1,59 @@
from datetime import datetime
from ninja import Schema
class LoginIn(Schema):
username: str
password: str
class RoleOut(Schema):
id: int
name: str
class UserGroupOut(Schema):
id: int
name: str
code: str
description: str = ""
is_active: bool = True
created_at: datetime | None = None
updated_at: datetime | None = None
class MenuOut(Schema):
id: int
code: str
title: str
path: str
icon: str
permission_code: str
is_visible: bool
is_enabled: bool
children: list["MenuOut"] = []
class CurrentUserOut(Schema):
id: int
username: str
display_name: str
email: str
is_superuser: bool
roles: list[RoleOut]
user_groups: list[UserGroupOut]
permissions: list[str]
menus: list[MenuOut]
class BasicUserOut(Schema):
id: int
username: str
display_name: str
email: str
is_active: bool
is_staff: bool
is_superuser: bool
roles: list[RoleOut] = []
user_groups: list[UserGroupOut] = []