Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions api/controllers/console/workspace/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
cloud_edition_billing_enabled,
enable_change_email,
enterprise_license_required,
model_validate,
only_edition_cloud,
setup_required,
with_current_user,
Expand Down Expand Up @@ -332,9 +333,9 @@ class AccountAvatarApi(Resource):
@login_required
@account_initialization_required
@with_current_user
def get(self, current_user: Account):
args = AccountAvatarQuery.model_validate(request.args.to_dict(flat=True))
avatar = args.avatar
@model_validate(AccountAvatarQuery)
def get(self, req_data: AccountAvatarQuery, current_user: Account):
avatar = req_data.avatar

if avatar.startswith(("http://", "https://")):
return AvatarUrlResponse(avatar_url=avatar).model_dump(mode="json")
Expand Down
19 changes: 9 additions & 10 deletions api/controllers/console/workspace/endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from http import HTTPStatus
from typing import Any

from flask import request
from flask_restx import Resource
from pydantic import BaseModel, Field

Expand Down Expand Up @@ -294,14 +293,14 @@ class EndpointListApi(Resource):
@account_initialization_required
@with_current_user_id
@with_current_tenant_id
def get(self, tenant_id: str, user_id: str):
args = EndpointListQuery.model_validate(request.args.to_dict(flat=True))
@model_validate(EndpointListQuery)
def get(self, req_data: EndpointListQuery, tenant_id: str, user_id: str):

endpoints = EndpointService.list_endpoints(
tenant_id=tenant_id,
user_id=user_id,
page=args.page,
page_size=args.page_size,
page=req_data.page,
page_size=req_data.page_size,
)

return EndpointListResponse(endpoints=endpoints).model_dump(mode="json")
Expand All @@ -322,15 +321,15 @@ class EndpointListForSinglePluginApi(Resource):
@account_initialization_required
@with_current_user_id
@with_current_tenant_id
def get(self, tenant_id: str, user_id: str):
args = EndpointListForPluginQuery.model_validate(request.args.to_dict(flat=True))
@model_validate(EndpointListForPluginQuery)
def get(self, req_data: EndpointListForPluginQuery, tenant_id: str, user_id: str):

endpoints = EndpointService.list_endpoints_for_single_plugin(
tenant_id=tenant_id,
user_id=user_id,
plugin_id=args.plugin_id,
page=args.page,
page_size=args.page_size,
plugin_id=req_data.plugin_id,
page=req_data.page,
page_size=req_data.page_size,
)

return EndpointListResponse(endpoints=endpoints).model_dump(mode="json")
Expand Down
Loading
Loading