update: cleaned up balance webhooks

This commit is contained in:
John Yeo
2026-03-23 16:29:36 +00:00
parent d3d5a2eef1
commit 416a633064
178 changed files with 12132 additions and 2454 deletions

View File

@@ -17,7 +17,8 @@
processor?: object | null,
processors?: object | null,
auto_topups?: array | null,
spend_limits?: array | null
spend_limits?: array | null,
usage_alerts?: array | null
}
}
@@ -111,4 +112,13 @@ if updates.spend_limits ~= nil then
table.insert(updated_fields, 'spend_limits')
end
if updates.usage_alerts ~= nil then
if is_nil(updates.usage_alerts) then
redis.call('JSON.SET', cache_key, '$.usage_alerts', 'null')
else
redis.call('JSON.SET', cache_key, '$.usage_alerts', cjson.encode(updates.usage_alerts))
end
table.insert(updated_fields, 'usage_alerts')
end
return cjson.encode({ success = true, updated_fields = updated_fields })