perf: 增加我的资产通过 node_id 过滤我的资产

pull/10077/head
Aaron3S 2023-03-27 14:37:04 +08:00 committed by Jiangjie.Bai
parent 1ac2fec13f
commit 017682b383
1 changed files with 7 additions and 2 deletions

View File

@ -4,7 +4,7 @@ from rest_framework.generics import ListAPIView
from assets.api.asset.asset import AssetFilterSet
from assets.models import Asset, Node
from common.utils import get_logger, lazyproperty
from common.utils import get_logger, lazyproperty, is_uuid
from perms import serializers
from perms.pagination import AllPermedAssetPagination
from perms.pagination import NodePermedAssetPagination
@ -58,7 +58,12 @@ class UserAllPermedAssetsApi(BaseUserPermedAssetsApi):
pagination_class = AllPermedAssetPagination
def get_assets(self):
return self.query_asset_util.get_all_assets()
node_id = self.request.query_params.get('node_id')
if is_uuid(node_id):
__, assets = self.query_asset_util.get_node_all_assets(node_id)
else:
assets = self.query_asset_util.get_all_assets()
return assets
class UserDirectPermedAssetsApi(BaseUserPermedAssetsApi):