feat(backend): add operational smoke tooling and safe pricing cleanup endpoints
- add backend README and refresh API map and smoke regression docs - add full backend smoke regression script - add admin pricing cleanup preview and dry-run endpoints - add helper script for test pricing cleanup - verify typed error contracts, draft flow, publish readiness and preview flows - verify publish preview retention and clean backend startup behavior
This commit is contained in:
38
backend/scripts/cleanup_test_pricing_data.sh
Executable file
38
backend/scripts/cleanup_test_pricing_data.sh
Executable file
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
API_URL="${API_URL:-http://127.0.0.1:9020}"
|
||||
API_KEY="${API_KEY:-admin-local-dev-key}"
|
||||
SCHEME_ID="${SCHEME_ID:-}"
|
||||
DRY_RUN="${DRY_RUN:-true}"
|
||||
|
||||
if [[ -z "${SCHEME_ID}" ]]; then
|
||||
echo "SCHEME_ID is required"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
REQUEST_BODY=$(cat <<JSON
|
||||
{
|
||||
"code_prefixes": ["FAIL_", "DIAG_", "AUTO_", "TYPED_"],
|
||||
"name_prefixes": ["should-fail-", "diag-", "auto ", "typed-response-"],
|
||||
"pricing_category_ids": [],
|
||||
"delete_only_without_rules": true,
|
||||
"dry_run": ${DRY_RUN}
|
||||
}
|
||||
JSON
|
||||
)
|
||||
|
||||
echo "===== CLEANUP PREVIEW ====="
|
||||
curl -sS \
|
||||
-H "X-API-Key: ${API_KEY}" \
|
||||
"${API_URL}/api/v1/admin/schemes/${SCHEME_ID}/pricing/categories/cleanup-preview?code_prefix=FAIL_&code_prefix=DIAG_&code_prefix=AUTO_&code_prefix=TYPED_&name_prefix=should-fail-&name_prefix=diag-&name_prefix=auto%20&name_prefix=typed-response-" \
|
||||
| python3 -m json.tool
|
||||
|
||||
echo
|
||||
echo "===== CLEANUP EXECUTE (DRY_RUN=${DRY_RUN}) ====="
|
||||
curl -sS -X POST \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "X-API-Key: ${API_KEY}" \
|
||||
-d "${REQUEST_BODY}" \
|
||||
"${API_URL}/api/v1/admin/schemes/${SCHEME_ID}/pricing/categories/cleanup" \
|
||||
| python3 -m json.tool
|
||||
Reference in New Issue
Block a user