feat: admin notification system with priority ordering, bell icon, and /notifications page

Two-tier notification system: new_booking (all public bookings) + pending_booking (notes/today).
Priority-sorted queue, unread count polling, enriched responses with user_name/booking_start_time.
Fix critical bug: edit_requested cleanup was broken (wrong reason string in 3 handlers).
Add 15 new tests covering priority ordering, enrichment, and notification creation flows.
Update Admin Manual, Technical Manual, and gap backlog docs.
This commit is contained in:
2026-05-16 23:41:18 +01:00
parent c3501ae89a
commit 7fc58f58d9
19 changed files with 1608 additions and 106 deletions
+23
View File
@@ -699,6 +699,28 @@ for ((i=0; i<${#PENDING_BOOKING_IDS[@]}; i++)); do
done
echo "${C_GREEN}✅ Confirmed $confirmed_count bookings, left $skipped_count pending for admin review${C_RESET}"
# ===========================================================================
# 5b. USER BOOKINGS WITH NOTES (triggers pending_booking notifications)
# These use the public endpoint so notifications are created.
# ===========================================================================
echo -e "\n${C_BLUE}📝 Creating User Bookings with Notes (notification triggers)..."
USER_NOTE_COUNT=0
# Emma — booking with special request notes (triggers new_booking + pending_booking)
D_NOTE1=$(open_day "$(TZ=Europe/London date -d "$TODAY +8 days" +%Y-%m-%d)")
if create_booking "$EMMA_TOKEN" "$(format_london_time "$D_NOTE1" "$SLOT_E")" "[\"$(get_svc 1)\"]" "Hi! Could I please have a nude base with white french tips and a single gold foil accent on the ring finger? Also I have a slight nail ridge on my left thumb - nothing major but worth noting." "Emma - French tips + gold foil (+8 days)"; then
USER_NOTE_COUNT=$((USER_NOTE_COUNT+1))
fi
# Isla — booking with notes for a different day (triggers new_booking + pending_booking)
D_NOTE2=$(open_day "$(TZ=Europe/London date -d "$TODAY +10 days" +%Y-%m-%d)")
if create_booking "$ISLA_TOKEN" "$(format_london_time "$D_NOTE2" "$SLOT_E")" "[\"$(get_svc 1)\",\"$(get_svc 5)\"]" "I'd like a chrome/mirror-ball effect on all nails if possible. Also I'm thinking of getting married soon so want to trial a bridal look - can we discuss options?" "Isla - Chrome trial (+10 days)"; then
USER_NOTE_COUNT=$((USER_NOTE_COUNT+1))
fi
echo "${C_GREEN}✅ Created $USER_NOTE_COUNT User Bookings with Notes (pending notifications)${C_RESET}"
# ===========================================================================
# 6. GUEST BOOKINGS
# ===========================================================================
@@ -1004,6 +1026,7 @@ echo -e " Bookings — total : $TOTAL_BOOKINGS"
echo -e " Cancellations : $cancel_count"
echo -e " Confirmed : $confirmed_count | Still pending: $skipped_count"
echo -e " Bookings — guest : $count_guest"
echo -e " Bookings — w/ notes: $USER_NOTE_COUNT (pending notifications)"
echo -e " Payments : $payment_count completed bookings"
echo -e " Time blockers : $count_blockers"
echo -e " Schedule groups : $sched_success/3"