fix: duplicate automation definition for pydantic model
This commit is contained in:
parent
13322e7cf8
commit
d59c6c8576
1 changed files with 10 additions and 7 deletions
|
|
@ -791,20 +791,23 @@ class AutomationObjects:
|
|||
if not self.checkRbacPermission(AutomationDefinition, "create"):
|
||||
raise PermissionError("No permission to create definitions")
|
||||
|
||||
# getAutomationDefinition returns Pydantic model; convert to dict for .get() access
|
||||
existing_data = existing.model_dump() if hasattr(existing, "model_dump") else existing
|
||||
|
||||
# Build duplicate data
|
||||
duplicateData = {
|
||||
"id": str(uuid.uuid4()),
|
||||
"mandateId": existing.get("mandateId"),
|
||||
"featureInstanceId": existing.get("featureInstanceId"),
|
||||
"label": f"{existing.get('label', '')} (Kopie)",
|
||||
"schedule": existing.get("schedule", ""),
|
||||
"template": existing.get("template", ""),
|
||||
"placeholders": existing.get("placeholders", {}),
|
||||
"mandateId": existing_data.get("mandateId"),
|
||||
"featureInstanceId": existing_data.get("featureInstanceId"),
|
||||
"label": f"{existing_data.get('label', '')} (Kopie)",
|
||||
"schedule": existing_data.get("schedule", ""),
|
||||
"template": existing_data.get("template", ""),
|
||||
"placeholders": existing_data.get("placeholders", {}),
|
||||
"active": False,
|
||||
"eventId": None,
|
||||
"status": None,
|
||||
"executionLogs": [],
|
||||
"allowedProviders": existing.get("allowedProviders", []),
|
||||
"allowedProviders": existing_data.get("allowedProviders", []),
|
||||
}
|
||||
|
||||
# Ensure database connector has correct userId context
|
||||
|
|
|
|||
Loading…
Reference in a new issue