60 lines
1.0 KiB
Python
60 lines
1.0 KiB
Python
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] = []
|