#!/usr/bin/env bash # Wipe otp_requests rows + (optionally) customer row for ${TEST_PHONE} so # repeated test runs don't trip the 60s cooldown or hit IDENTITY_CONFLICT. # # Runs against backend's dev-only /internal/_test/reset-phone endpoint. set -euo pipefail phone="${TEST_PHONE:-}" url="${BACKEND_INTERNAL_URL:-http://localhost:3001}" drop_customer="${DROP_CUSTOMER:-true}" if [[ -z "$phone" ]]; then echo "TEST_PHONE env var required" >&2 exit 1 fi curl -fsS -X POST "${url}/internal/_test/reset-phone" \ -H "Content-Type: application/json" \ -d "{\"phone\":\"${phone}\",\"drop_customer\":${drop_customer}}" >/dev/null echo "reset complete: ${phone}"