#!/usr/bin/env python # -*- coding: utf-8 -*- from typing import Optional, List from pydantic import BaseModel from admin.schemas.sysdata.sysmodule import SysApiItem from schemas.base import ListMixin, DetailMixin class RoleItem(BaseModel): id: int name: str is_active: bool class Config: orm_mode = True class RoleItemList(ListMixin): data: Optional[List[RoleItem]] = [] class CreateRole(BaseModel): name: str description: str = "" creator: int = 0 class UpdateRole(BaseModel): name: Optional[str] = None description: Optional[str] = None editor: Optional[int] = None class RoleDetail(DetailMixin): data: Optional[RoleItem] = None class CreateRoleApi(BaseModel): role_id: int api_id: int class RoleApiList(ListMixin): data: Optional[List[SysApiItem]] = [] class AssignRoleApi(BaseModel): role_id: Optional[int] = None apis: List[int]