chore: update init scripts, dev script, and remove stale HAR file

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
2026-05-28 16:34:13 +01:00
co-authored by Sisyphus
parent 91d20d474b
commit d23ed1831a
3 changed files with 124 additions and 186 deletions
+25 -10
View File
@@ -398,14 +398,15 @@ get_svc() { echo "${SERVICE_IDS[$1]}"; }
# ===========================================================================
echo -e "\n${C_BLUE}🧪 Creating Patch Tests...${C_RESET}"
# Gel Allergy Test covers: Gel Polish Full Set (idx 6), Luxury Gel Manicure (idx 7)
GEL_SVC_1="${SERVICE_IDS[6]}"
GEL_SVC_2="${SERVICE_IDS[7]}"
# Gel Allergy Test covers: Gel Manicure BIAB (idx 1), Gel Polish Full Set (idx 6), Luxury Gel Manicure (idx 7)
GEL_SVC_1="${SERVICE_IDS[1]}"
GEL_SVC_6="${SERVICE_IDS[6]}"
GEL_SVC_7="${SERVICE_IDS[7]}"
# Insert patch test directly via SQL (no creation API endpoint exists)
# service_ids cast explicitly to uuid[] to handle typed columns
PATCH_TEST_RESULT=$(docker exec postgres psql -U myuser -d mydb -tAc \
"INSERT INTO patch_tests (name, description, notice_duration_hours, expiry_months, service_ids) VALUES ('Gel Allergy Test', 'Mandatory patch test for all gel polish services. Must be completed at least 24 hours before your first gel appointment.', 24, 6, ARRAY['${GEL_SVC_1}','${GEL_SVC_2}']) RETURNING id;" 2>&1)
"INSERT INTO patch_tests (name, description, notice_duration_hours, expiry_months, service_ids) VALUES ('Gel Allergy Test', 'Mandatory patch test for all gel polish services. Must be completed at least 24 hours before your first gel appointment.', 24, 6, ARRAY['${GEL_SVC_1}','${GEL_SVC_6}','${GEL_SVC_7}']) RETURNING id;" 2>&1)
PATCH_TEST_ID=$(echo "$PATCH_TEST_RESULT" | head -1 | tr -d '\r\t ')
# Validate it looks like a UUID; print raw output if not to help diagnose
@@ -414,12 +415,26 @@ if [[ -z "$PATCH_TEST_ID" || ! "$PATCH_TEST_ID" =~ ^[0-9a-f-]{8,}$ ]]; then
PATCH_TEST_ID=""
fi
# Record that Grace has already completed her patch test via the API
if [[ -n "$PATCH_TEST_ID" && -n "$GRACE_ID" ]]; then
api_post "$BASE_URL/admin/users/$GRACE_ID/patch-tests" \
"{\"patch_test_id\":\"$PATCH_TEST_ID\"}" \
"Record patch test for Grace" "$ADMIN_TOKEN" > /dev/null
echo "${C_GREEN}✅ Patch test seeded (SQL) and recorded for Grace Fletcher${C_RESET}"
# Record patch tests for ALL users who book gel services so no booking gets 400'd
PATCH_TEST_USERS=(
"$GRACE_ID:Grace Fletcher" # Luxury Gel Manicure / Gel Full Set
"$EMMA_ID:Emma Johnson" # Gel Manicure (BIAB) — regular gel client
"$ISLA_ID:Isla Davies" # Gel Manicure (BIAB) + Nail Art
"$LILY_ID:Lily Wilson" # Gel Manicure (BIAB) + Nail Art
)
patch_recorded=0
if [[ -n "$PATCH_TEST_ID" ]]; then
for entry in "${PATCH_TEST_USERS[@]}"; do
uid="${entry%%:*}"
name="${entry#*:}"
if [[ -n "$uid" ]]; then
api_post "$BASE_URL/admin/users/$uid/patch-tests" \
"{\"patch_test_id\":\"$PATCH_TEST_ID\"}" \
"Record patch test for $name" "$ADMIN_TOKEN" > /dev/null \
&& patch_recorded=$((patch_recorded + 1))
fi
done
echo "${C_GREEN}✅ Patch test seeded (SQL) and recorded for $patch_recorded users${C_RESET}"
else
echo "${C_YELLOW}⚠️ Patch test seeding failed (check DB connection or patch_tests table)${C_RESET}"
fi