修复修改更新应用
This commit is contained in:
@@ -12,7 +12,7 @@ from app.services.user_oauth_app_service import (
|
||||
update_user_oauth_app,
|
||||
)
|
||||
|
||||
router = APIRouter(prefix="/user-oauth-apps", tags=["oauth"])
|
||||
router = APIRouter(prefix="/admin/user-oauth-apps", tags=["oauth"])
|
||||
|
||||
|
||||
@router.get("/list", summary="获取用户授权应用列表")
|
||||
@@ -34,7 +34,7 @@ async def list_apps(
|
||||
}
|
||||
|
||||
|
||||
@router.post("/create", summary="创建用户授权应用", response_model=UserOAuthAppOut, status_code=status.HTTP_201_CREATED)
|
||||
@router.post("/create", summary="创建用户授权应用")
|
||||
async def create_app(
|
||||
req: UserOAuthAppCreate,
|
||||
admin: User = Depends(get_admin_user),
|
||||
@@ -42,7 +42,7 @@ async def create_app(
|
||||
):
|
||||
try:
|
||||
app = await create_user_oauth_app(db, req.app_id, req.secret, req.open_type, admin.id)
|
||||
return app
|
||||
return UserOAuthAppOut.model_validate(app)
|
||||
except ValueError as e:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_400_BAD_REQUEST,
|
||||
@@ -50,7 +50,7 @@ async def create_app(
|
||||
)
|
||||
|
||||
|
||||
@router.get("/read/{id}", summary="获取用户授权应用详情", response_model=UserOAuthAppOut)
|
||||
@router.get("/read/{id}", summary="获取用户授权应用详情")
|
||||
async def get_app(
|
||||
id: str,
|
||||
admin: User = Depends(get_admin_user),
|
||||
@@ -62,10 +62,10 @@ async def get_app(
|
||||
status_code=status.HTTP_404_NOT_FOUND,
|
||||
detail="应用不存在",
|
||||
)
|
||||
return app
|
||||
return UserOAuthAppOut.model_validate(app)
|
||||
|
||||
|
||||
@router.post("/update/{id}", summary="更新用户授权应用", response_model=UserOAuthAppOut)
|
||||
@router.post("/update/{id}", summary="更新用户授权应用")
|
||||
async def update_app(
|
||||
id: str,
|
||||
req: UserOAuthAppUpdate,
|
||||
@@ -78,7 +78,7 @@ async def update_app(
|
||||
status_code=status.HTTP_404_NOT_FOUND,
|
||||
detail="应用不存在",
|
||||
)
|
||||
return app
|
||||
return UserOAuthAppOut.model_validate(app)
|
||||
|
||||
|
||||
@router.get("/delete/{id}", summary="删除用户授权应用")
|
||||
|
||||
Reference in New Issue
Block a user