Skip to content

Commit 39a15ea

Browse files
committed
Validations were not working with Set parameter
- Removed the use of the Set operator for updating graph template fields. - Directly assigned values to graph template attributes and called save() to persist changes. - This change enhances code readability and maintains functionality for setting secrets and updating validation status.
1 parent 59b5ba8 commit 39a15ea

1 file changed

Lines changed: 7 additions & 10 deletions

File tree

state-manager/app/controller/upsert_graph_template.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from app.tasks.verify_graph import verify_graph
66

77
from fastapi import BackgroundTasks, HTTPException
8-
from beanie.operators import Set
98

109
logger = LogsManager().get_logger()
1110

@@ -23,15 +22,13 @@ async def upsert_graph_template(namespace_name: str, graph_name: str, body: Upse
2322
namespace_name=namespace_name,
2423
x_exosphere_request_id=x_exosphere_request_id)
2524

26-
await graph_template.set_secrets(body.secrets).update(
27-
Set({
28-
GraphTemplate.nodes: body.nodes, # type: ignore
29-
GraphTemplate.validation_status: GraphTemplateValidationStatus.PENDING, # type: ignore
30-
GraphTemplate.validation_errors: [], # type: ignore
31-
GraphTemplate.retry_policy: body.retry_policy, # type: ignore
32-
GraphTemplate.store_config: body.store_config # type: ignore
33-
})
34-
)
25+
graph_template.set_secrets(body.secrets)
26+
graph_template.validation_status = GraphTemplateValidationStatus.PENDING
27+
graph_template.validation_errors = []
28+
graph_template.retry_policy = body.retry_policy
29+
graph_template.store_config = body.store_config
30+
graph_template.nodes = body.nodes
31+
await graph_template.save()
3532

3633
else:
3734
logger.info(

0 commit comments

Comments
 (0)