constants.py 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. from enum import Enum
  2. class UserRole(Enum):
  3. """用户角色枚举"""
  4. ADMIN = 'admin' # 管理员
  5. DEVELOPER = 'developer' # 开发者
  6. USER = 'user' # 普通用户
  7. @classmethod
  8. def list(cls):
  9. """返回所有用户角色"""
  10. return [item.value for item in cls]
  11. class UserStatus(Enum):
  12. """用户状态枚举"""
  13. ACTIVE = 'active' # 在线
  14. INACTIVE = 'inactive' # 离线
  15. BANNED = 'banned' # 封禁
  16. DELETED = 'deleted' # 注销
  17. @classmethod
  18. def list(cls):
  19. """返回所有用户状态"""
  20. return [item.value for item in cls]
  21. class DiseaseGrade(Enum):
  22. """病害评估等级枚举"""
  23. MILD = 'mild' # 轻度
  24. MODERATE = 'moderate' # 中度
  25. SEVERE = 'severe' # 重度
  26. CRITICAL = 'critical' # 严重
  27. @classmethod
  28. def list(cls):
  29. """返回所有病害等级"""
  30. return [item.value for item in cls]
  31. class TaskStatus(Enum):
  32. """检测任务状态枚举"""
  33. PENDING = 'pending' # 待处理
  34. IN_PROGRESS = 'in_progress' # 检测中
  35. COMPLETED = 'completed' # 已完成
  36. FAILED = 'failed' # 失败
  37. @classmethod
  38. def list(cls):
  39. """返回所有任务状态"""
  40. return [item.value for item in cls]
  41. class OperationType(Enum):
  42. """操作类型枚举"""
  43. AUTHENTICATE = 'authenticate' # 鉴权
  44. CREATE = 'create' # 创建
  45. READ = 'read' # 读取
  46. UPDATE = 'update' # 更新
  47. DELETE = 'delete' # 删除
  48. EXECUTE = 'execute' # 执行任务
  49. MANAGE = 'manage' # 管理操作
  50. @classmethod
  51. def list(cls):
  52. """获取所有操作类型的列表"""
  53. return [item.value for item in cls]
  54. class OperationStatus(Enum):
  55. """操作状态枚举"""
  56. SUCCESS = 'success' # 操作成功
  57. FAILURE = 'failure' # 操作失败
  58. @classmethod
  59. def list(cls):
  60. """获取所有操作状态的列表"""
  61. return [item.value for item in cls]