Initial FastAPI admin auth scaffold
This commit is contained in:
1
app/constants/__init__.py
Normal file
1
app/constants/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
"""Application constants."""
|
||||
6
app/constants/admin_code.py
Normal file
6
app/constants/admin_code.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from enum import IntEnum
|
||||
|
||||
|
||||
class AdminCode(IntEnum):
|
||||
DISABLED = 30001
|
||||
FORBIDDEN = 30002
|
||||
1
app/constants/model/__init__.py
Normal file
1
app/constants/model/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
"""Model constants."""
|
||||
1
app/constants/model/admin_user/__init__.py
Normal file
1
app/constants/model/admin_user/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
"""Admin user constants."""
|
||||
12
app/constants/model/admin_user/admin_user_status_code.py
Normal file
12
app/constants/model/admin_user/admin_user_status_code.py
Normal file
@@ -0,0 +1,12 @@
|
||||
from enum import IntEnum
|
||||
|
||||
|
||||
class AdminUserStatusCode(IntEnum):
|
||||
NORMAL = 1
|
||||
DISABLE = 2
|
||||
|
||||
def is_normal(self) -> bool:
|
||||
return self is AdminUserStatusCode.NORMAL
|
||||
|
||||
def is_disable(self) -> bool:
|
||||
return self is AdminUserStatusCode.DISABLE
|
||||
12
app/constants/result_code.py
Normal file
12
app/constants/result_code.py
Normal file
@@ -0,0 +1,12 @@
|
||||
from enum import IntEnum
|
||||
|
||||
|
||||
class ResultCode(IntEnum):
|
||||
SUCCESS = 0
|
||||
ERROR = 1
|
||||
JWT_EXPIRED = 10001
|
||||
JWT_ERROR = 10002
|
||||
OLD_PASSWORD_ERROR = 10003
|
||||
ACCOUNT_DEACTIVATING = 20001
|
||||
ACCOUNT_DEACTIVATED = 20002
|
||||
ACCOUNT_CANNOT_DEACTIVATE = 20003
|
||||
Reference in New Issue
Block a user