-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from pylover7/develop
✨feat(superAdmin): 超管面板
- Loading branch information
Showing
121 changed files
with
15,971 additions
and
4,676 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,23 @@ | ||
from fastapi import APIRouter | ||
|
||
from app.core.dependency import DependPermisson | ||
from app.core.dependency import DependPermission, DependAuth | ||
|
||
from .apis import apis_router | ||
from .base import base_router | ||
from .menus import menus_router | ||
from .roles import roles_router | ||
from .users import users_router | ||
from .material import material_router | ||
from .admin import admin_router | ||
from .superAdmin import depart_router | ||
|
||
v1_router = APIRouter() | ||
|
||
v1_router.include_router(base_router, prefix="/base") | ||
v1_router.include_router(users_router, prefix="/user", dependencies=[DependPermisson]) | ||
v1_router.include_router(roles_router, prefix="/role", dependencies=[DependPermisson]) | ||
v1_router.include_router(menus_router, prefix="/menu", dependencies=[DependPermisson]) | ||
v1_router.include_router(apis_router, prefix="/api", dependencies=[DependPermisson]) | ||
v1_router.include_router(material_router, prefix="/material", dependencies=[DependPermisson]) | ||
v1_router.include_router(users_router, prefix="/user", dependencies=[DependPermission]) | ||
v1_router.include_router(roles_router, prefix="/role", dependencies=[DependPermission]) | ||
v1_router.include_router(menus_router, prefix="/menu", dependencies=[DependPermission]) | ||
v1_router.include_router(apis_router, prefix="/api", dependencies=[DependPermission]) | ||
v1_router.include_router(material_router, prefix="/material", dependencies=[DependPermission]) | ||
v1_router.include_router(admin_router, prefix="/admin", dependencies=[DependAuth]) | ||
v1_router.include_router(depart_router, prefix="/depart", dependencies=[DependPermission]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# coding=utf-8 | ||
# @FileName :__init__.py.py | ||
# @Time :2024/4/16 下午9:30 | ||
# @Author :dayezi | ||
from fastapi import APIRouter | ||
|
||
from .admin import router | ||
|
||
admin_router = APIRouter() | ||
admin_router.include_router(router, tags=["管理员模块"]) | ||
|
||
__all__ = ["admin_router"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# coding=utf-8 | ||
# @FileName :users.py | ||
# @Time :2024/4/16 下午9:31 | ||
# @Author :dayezi | ||
from fastapi import APIRouter, Request | ||
|
||
from app.settings import settings | ||
from app.core.init_db import test_db, set_db | ||
from app.log import logger | ||
from app.schemas import Success, Fail | ||
from app.schemas.admin import DbInfo | ||
|
||
router = APIRouter() | ||
|
||
|
||
@router.get("/get_db_info") | ||
async def get_db_info(): | ||
data = settings.DATABASE_INFO.model_dump() | ||
return Success(data=data) | ||
|
||
|
||
@router.post("/test_db_info", summary="测试数据库连接") | ||
async def test_db_conn(data: DbInfo): | ||
if test_db(data): | ||
return Success(msg="数据库链接成功!") | ||
else: | ||
return Fail(msg="数据库链接失败!") | ||
|
||
|
||
@router.post("/set_db_info", summary="设置数据库连接") | ||
async def set_db_conn(data: DbInfo, request: Request): | ||
try: | ||
await set_db(data, request.app) | ||
return Success(msg="数据库设置成功!") | ||
except Exception as e: | ||
logger.error(e) | ||
return Fail(msg="数据库设置失败!") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.