Files
fastapi-best-architecture/backend/common/enums.py
T
Wu Clan 5e438c685d Refactor the backend architecture (#299)
* define the basic architecture

* Update script and deployment file locations

* Update the route registration

* Fix CI download dependencies

* Updated ruff to 0.3.3

* Update app subdirectory naming

* Update the model import

* fix pre-commit pdm lock

* Update the service directory naming

* Add CRUD method documents

* Fix the issue of circular import

* Update the README document

* Update the SQL statement for create tables

* Update docker scripts and documentation

* Fix docker scripts

* Update the backend README.md

* Add the security folder and move the redis client

* Update the configuration item

* Fix environment configuration reads

* Update the default configuration

* Updated README description

* Updated the user registration API

* Fix test cases

* Update the celery configuration

* Update and fix celery configuration

* Updated the celery structure

* Update celery tasks and api

* Add celery flower

* Update the import style

* Update contributors
2024-03-22 18:16:15 +08:00

90 lines
1.4 KiB
Python

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from enum import Enum
from enum import IntEnum as SourceIntEnum
from typing import Type
class _EnumBase:
@classmethod
def get_member_keys(cls: Type[Enum]) -> list[str]:
return [name for name in cls.__members__.keys()]
@classmethod
def get_member_values(cls: Type[Enum]) -> list:
return [item.value for item in cls.__members__.values()]
class IntEnum(_EnumBase, SourceIntEnum):
"""整型枚举"""
pass
class StrEnum(_EnumBase, str, Enum):
"""字符串枚举"""
pass
class MenuType(IntEnum):
"""菜单类型"""
directory = 0
menu = 1
button = 2
class RoleDataScopeType(IntEnum):
"""数据范围"""
all = 1
custom = 2
class MethodType(StrEnum):
"""请求方法"""
GET = 'GET'
POST = 'POST'
PUT = 'PUT'
DELETE = 'DELETE'
PATCH = 'PATCH'
OPTIONS = 'OPTIONS'
class LoginLogStatusType(IntEnum):
"""登陆日志状态"""
fail = 0
success = 1
class BuildTreeType(StrEnum):
"""构建树形结构类型"""
traversal = 'traversal'
recursive = 'recursive'
class OperaLogCipherType(IntEnum):
"""操作日志加密类型"""
aes = 0
md5 = 1
itsdangerous = 2
plan = 3
class StatusType(IntEnum):
"""状态类型"""
disable = 0
enable = 1
class UserSocialType(StrEnum):
"""用户社交类型"""
github = 'GitHub'