perf: 资产创建添加账号 没有携带密码 (#9436)

Co-authored-by: feng <1304903146@qq.com>
pull/9438/head
fit2bot 2 years ago committed by GitHub
parent 4af80bfcdf
commit 9a1109e13d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -242,10 +242,18 @@ class AssetSerializer(BulkOrgResourceModelSerializer, WritableNestedModelSeriali
})
return protocols_data_map.values()
@staticmethod
def accounts_create(accounts_data, asset):
for data in accounts_data:
data['asset'] = asset
AssetAccountSerializer().create(data)
@atomic
def create(self, validated_data):
nodes_display = validated_data.pop('nodes_display', '')
accounts = validated_data.pop('accounts', [])
instance = super().create(validated_data)
self.accounts_create(accounts, instance)
self.perform_nodes_display_create(instance, nodes_display)
return instance

Loading…
Cancel
Save