Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions app/api/routers/breeze_buddy/templates/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
raise ValueError("nodes must be specified in flow structure")

# Check if template already exists
existing = await get_template_by_merchant(

Check warning on line 85 in app/api/routers/breeze_buddy/templates/handlers.py

View workflow job for this annotation

GitHub Actions / build

Pyrefly deprecated

`app.database.accessor.breeze_buddy.template.get_template_by_merchant` is deprecated Name-based template lookup. Pass template_id and use get_template_by_id_with_fallback() instead.
template_data.reseller_id,
template_data.merchant_id,
template_data.name,
Expand Down Expand Up @@ -110,10 +110,15 @@
# Create the template
now = datetime.now(timezone.utc)

# Build configurations dict from the ConfigurationModel
# Build configurations dict from the ConfigurationModel.
# mode="json" unwraps SecretStr fields (e.g. mcp.servers[*].auth.token)
# to their string value so the downstream json.dumps in
# ``create_template`` doesn't choke on a SecretStr instance.
configurations = None
if template_data.configurations:
configurations = template_data.configurations.model_dump(exclude_none=True)
configurations = template_data.configurations.model_dump(
exclude_none=True, mode="json"
)

template = await create_template(
template_id=str(uuid4()),
Expand Down Expand Up @@ -186,7 +191,7 @@
)

try:
template = await get_template_by_merchant(

Check warning on line 194 in app/api/routers/breeze_buddy/templates/handlers.py

View workflow job for this annotation

GitHub Actions / build

Pyrefly deprecated

`app.database.accessor.breeze_buddy.template.get_template_by_merchant` is deprecated Name-based template lookup. Pass template_id and use get_template_by_id_with_fallback() instead.
reseller_id=reseller_id,
merchant_id=merchant_id,
name=name,
Expand Down Expand Up @@ -398,11 +403,15 @@
# Update the template
now = datetime.now(timezone.utc)

# Build configurations dict from the ConfigurationModel
# If configurations is explicitly provided, use it; otherwise set to None (NULL)
# Build configurations dict from the ConfigurationModel.
# mode="json" unwraps SecretStr fields (e.g. mcp.servers[*].auth.token)
# to their string value so the downstream json.dumps in
# ``replace_template`` doesn't choke on a SecretStr instance.
configurations = None
if template_data.configurations:
configurations = template_data.configurations.model_dump(exclude_none=True)
configurations = template_data.configurations.model_dump(
exclude_none=True, mode="json"
)

# Merge secrets: preserve **** values from existing, update real values
merged_secrets = merge_secrets(
Expand Down
Loading