#!/usr/bin/env python # -*- coding: utf-8 -*- from typing import List, Optional from pydantic import Field from pydantic.main import BaseModel from schemas.base import ListMixin, Datetime2Str, DetailMixin class RoleInfo(BaseModel): id: Optional[int] = None name: str = Field(..., description="角色名称") platform: str = Field(..., description="备注") remark: Optional[str] = Field(None, description="备注") permission_codes: Optional[str] = None creator_name: str = Field(None, description="创建人名称") created_at: Optional[Datetime2Str] = Field(None, description="创建时间") class Config: orm_mode = True anystr_strip_whitespace = True class RoleList(ListMixin): data: List[RoleInfo] = [] class RoleDetail(DetailMixin): data: Optional[RoleInfo] = {} class PermissionItem(BaseModel): id: int = Field(..., description="id") name: str = Field(..., description="名称") codename: str = Field(..., description="权限代码") remark: Optional[str] = Field(None, description="备注") platform: str = Field(..., description="平台") api: str = Field(None, description="接口地址") method: str = Field(None, description="请求方法") order: int = Field(..., description="排序字段") class Config: orm_mode = True anystr_strip_whitespace = True class PermissionList(ListMixin): data: List[PermissionItem] = []