sysmodule.py 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. from typing import Optional, List
  4. from pydantic.main import BaseModel
  5. from schemas.base import ListMixin, DetailMixin
  6. class SysModuleItem(BaseModel):
  7. id: int
  8. name: str
  9. pid: int
  10. level: int
  11. class Config:
  12. orm_mode = True
  13. class SysModuleList(ListMixin):
  14. data: Optional[List[SysModuleItem]] = []
  15. class CreateSysModule(BaseModel):
  16. name: str
  17. pid: int
  18. level: int
  19. creator: Optional[int] = None
  20. class UpdateSysModule(BaseModel):
  21. name: Optional[str] = None
  22. pid: Optional[int] = None
  23. level: Optional[int] = None
  24. editor: Optional[int] = None
  25. class SysModuleDetail(DetailMixin):
  26. data: Optional[SysModuleItem] = None
  27. class SysApiItem(BaseModel):
  28. id: int
  29. name: str
  30. path: str
  31. method: str
  32. is_active: bool
  33. class Config:
  34. orm_mode = True
  35. class SysApiItemList(ListMixin):
  36. data: Optional[List[SysApiItem]] = []
  37. class SysApiItemDetail(DetailMixin):
  38. data: Optional[SysApiItem] = None
  39. class CreateSysApi(BaseModel):
  40. name: str
  41. path: str
  42. method: str
  43. module_id: int
  44. creator: Optional[int] = None
  45. class UpdateSysApi(BaseModel):
  46. name: Optional[str] = None
  47. module_id: Optional[int] = None
  48. editor: Optional[int] = None
  49. class DeleteSysApi(BaseModel):
  50. id: int
  51. is_active: bool = False
  52. editor: int