refactor: update application setting serializer to set default favicon and improve user resource permission handling

This commit is contained in:
wxg0103 2025-07-08 11:47:00 +08:00
parent 4143d1f2c5
commit 337461b683

View File

@ -327,11 +327,12 @@ class ModelSerializer(serializers.Serializer):
model = Model(**model_data) model = Model(**model_data)
try: try:
model.save() model.save()
UserResourcePermissionSerializer(data={ if workspace_id != 'None':
'workspace_id': self.data.get('workspace_id'), UserResourcePermissionSerializer(data={
'user_id': self.data.get('user_id'), 'workspace_id': workspace_id,
'auth_target_type': AuthTargetType.MODEL.value 'user_id': self.data.get('user_id'),
}).auth_resource(str(model.id)) 'auth_target_type': AuthTargetType.MODEL.value
}).auth_resource(str(model.id))
except Exception as save_error: except Exception as save_error:
# 可添加日志记录 # 可添加日志记录
raise AppApiException(500, _("Model saving failed")) from save_error raise AppApiException(500, _("Model saving failed")) from save_error