Fix booking count filters, add admin notifications, and improve bookings
UI
This commit is contained in:
+65
-18
@@ -164,16 +164,16 @@ for SERVICE_JSON in "${SERVICES[@]}"; do
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo "Creating: $SERVICE_NAME"
|
||||
echo "Request JSON: $SERVICE_JSON"
|
||||
|
||||
|
||||
CREATE_RESPONSE=$(curl -s -w "\n%{http_code}" -X POST \
|
||||
-H 'Content-Type: application/json' \
|
||||
-H "Authorization: Bearer $ADMIN_TOKEN" \
|
||||
-d "$SERVICE_JSON" \
|
||||
"$BASE_URL/admin/services")
|
||||
|
||||
|
||||
HTTP_CODE=$(echo "$CREATE_RESPONSE" | tail -n1)
|
||||
RESPONSE_BODY=$(echo "$CREATE_RESPONSE" | sed '$d')
|
||||
|
||||
|
||||
if [ "$HTTP_CODE" = "201" ]; then
|
||||
SUCCESS_COUNT=$((SUCCESS_COUNT + 1))
|
||||
echo "✅ Created: $SERVICE_NAME"
|
||||
@@ -207,7 +207,7 @@ done
|
||||
|
||||
# --- 7️⃣ Create Demo Bookings ---
|
||||
echo ""
|
||||
echo "7️⃣ Creating 6 Demo Bookings..."
|
||||
echo "7️⃣ Creating 41 Demo Bookings (35 past + 6 future)..."
|
||||
|
||||
# Function to create a booking
|
||||
create_booking() {
|
||||
@@ -216,28 +216,28 @@ create_booking() {
|
||||
local SERVICE_IDS_JSON=$3
|
||||
local NOTES=$4
|
||||
local BOOKING_NAME=$5
|
||||
|
||||
|
||||
local BOOKING_JSON="{\"start_time\":\"$START_TIME\",\"service_ids\":$SERVICE_IDS_JSON"
|
||||
if [ -n "$NOTES" ]; then
|
||||
BOOKING_JSON="$BOOKING_JSON,\"notes\":\"$NOTES\""
|
||||
fi
|
||||
BOOKING_JSON="$BOOKING_JSON}"
|
||||
|
||||
|
||||
echo ""
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo "Creating: $BOOKING_NAME"
|
||||
echo "Time: $START_TIME"
|
||||
echo "Services: $SERVICE_IDS_JSON"
|
||||
|
||||
|
||||
CREATE_RESPONSE=$(curl -s -w "\n%{http_code}" -X POST \
|
||||
-H 'Content-Type: application/json' \
|
||||
-H "Authorization: Bearer $TOKEN" \
|
||||
-d "$BOOKING_JSON" \
|
||||
"$BASE_URL/bookings")
|
||||
|
||||
|
||||
HTTP_CODE=$(echo "$CREATE_RESPONSE" | tail -n1)
|
||||
RESPONSE_BODY=$(echo "$CREATE_RESPONSE" | sed '$d')
|
||||
|
||||
|
||||
if [ "$HTTP_CODE" = "201" ]; then
|
||||
echo "✅ Created: $BOOKING_NAME"
|
||||
BOOKING_ID=$(echo "$RESPONSE_BODY" | grep -o '"id":"[^"]*' | cut -d'"' -f4)
|
||||
@@ -248,20 +248,13 @@ create_booking() {
|
||||
echo "Response body: $RESPONSE_BODY"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
sleep 0.2
|
||||
}
|
||||
|
||||
# Use TZ=Europe/London to generate London-local times with correct offset
|
||||
# Note: date command respects TZ for parsing and formatting
|
||||
|
||||
# Get tomorrow at 08:00 London time as base (ensures future)
|
||||
TOMORROW_BASE=$(TZ=Europe/London date -d "tomorrow 08:00" +%Y-%m-%d)
|
||||
|
||||
# Calculate future dates in London time
|
||||
NEXT_WEEK_DATE=$(TZ=Europe/London date -d "$TOMORROW_BASE +7 days" +%Y-%m-%d)
|
||||
WEEK_AFTER_DATE=$(TZ=Europe/London date -d "$TOMORROW_BASE +14 days" +%Y-%m-%d)
|
||||
|
||||
# Helper function to format a London time as RFC3339 with 'T' (required by Go backend)
|
||||
format_london_time() {
|
||||
local DATE_PART="$1"
|
||||
@@ -269,6 +262,60 @@ format_london_time() {
|
||||
TZ=Europe/London date -d "$DATE_PART $TIME_PART" +"%Y-%m-%dT%H:%M:%S%:z"
|
||||
}
|
||||
|
||||
# --- PAST BOOKINGS (35 bookings from October-November 2025) ---
|
||||
echo ""
|
||||
echo "Creating 35 past bookings..."
|
||||
|
||||
# October 2025 bookings (15 bookings)
|
||||
create_booking "$USER_TOKEN" "$(format_london_time "2025-10-01" "10:00:00")" "[\"${SERVICE_IDS[0]}\"]" "" "Oct 1 - Classic Manicure"
|
||||
create_booking "$USER_TOKEN" "$(format_london_time "2025-10-03" "14:30:00")" "[\"${SERVICE_IDS[1]}\"]" "" "Oct 3 - Gel Manicure"
|
||||
create_booking "$USER_TOKEN" "$(format_london_time "2025-10-05" "11:00:00")" "[\"${SERVICE_IDS[2]}\"]" "Treating myself" "Oct 5 - Luxury Pedicure"
|
||||
create_booking "$USER_TOKEN" "$(format_london_time "2025-10-08" "15:45:00")" "[\"${SERVICE_IDS[3]}\"]" "" "Oct 8 - Express Mani & Pedi"
|
||||
create_booking "$USER_TOKEN" "$(format_london_time "2025-10-10" "09:30:00")" "[\"${SERVICE_IDS[0]}\",\"${SERVICE_IDS[5]}\"]" "Simple nail art" "Oct 10 - Classic + Nail Art"
|
||||
create_booking "$USER_TOKEN" "$(format_london_time "2025-10-12" "13:00:00")" "[\"${SERVICE_IDS[1]}\"]" "" "Oct 12 - Gel Manicure"
|
||||
create_booking "$USER_TOKEN" "$(format_london_time "2025-10-15" "16:00:00")" "[\"${SERVICE_IDS[4]}\"]" "" "Oct 15 - Gel Removal"
|
||||
create_booking "$USER_TOKEN" "$(format_london_time "2025-10-17" "10:30:00")" "[\"${SERVICE_IDS[2]}\"]" "" "Oct 17 - Luxury Pedicure"
|
||||
create_booking "$USER_TOKEN" "$(format_london_time "2025-10-19" "14:00:00")" "[\"${SERVICE_IDS[0]}\"]" "" "Oct 19 - Classic Manicure"
|
||||
create_booking "$USER_TOKEN" "$(format_london_time "2025-10-22" "11:30:00")" "[\"${SERVICE_IDS[3]}\"]" "Quick refresh" "Oct 22 - Express Mani & Pedi"
|
||||
create_booking "$USER_TOKEN" "$(format_london_time "2025-10-24" "15:00:00")" "[\"${SERVICE_IDS[1]}\",\"${SERVICE_IDS[5]}\"]" "" "Oct 24 - Gel + Nail Art"
|
||||
create_booking "$USER_TOKEN" "$(format_london_time "2025-10-26" "09:00:00")" "[\"${SERVICE_IDS[0]}\"]" "" "Oct 26 - Classic Manicure"
|
||||
create_booking "$USER_TOKEN" "$(format_london_time "2025-10-28" "13:30:00")" "[\"${SERVICE_IDS[2]}\"]" "" "Oct 28 - Luxury Pedicure"
|
||||
create_booking "$USER_TOKEN" "$(format_london_time "2025-10-29" "16:30:00")" "[\"${SERVICE_IDS[4]}\",\"${SERVICE_IDS[1]}\"]" "" "Oct 29 - Removal + New Gel"
|
||||
create_booking "$USER_TOKEN" "$(format_london_time "2025-10-31" "12:00:00")" "[\"${SERVICE_IDS[0]}\",\"${SERVICE_IDS[5]}\"]" "Halloween nails!" "Oct 31 - Classic + Nail Art"
|
||||
|
||||
# November 2025 bookings (20 bookings)
|
||||
create_booking "$USER_TOKEN" "$(format_london_time "2025-11-02" "10:00:00")" "[\"${SERVICE_IDS[1]}\"]" "" "Nov 2 - Gel Manicure"
|
||||
create_booking "$USER_TOKEN" "$(format_london_time "2025-11-04" "14:00:00")" "[\"${SERVICE_IDS[0]}\"]" "" "Nov 4 - Classic Manicure"
|
||||
create_booking "$USER_TOKEN" "$(format_london_time "2025-11-05" "11:30:00")" "[\"${SERVICE_IDS[3]}\"]" "" "Nov 5 - Express Mani & Pedi"
|
||||
create_booking "$USER_TOKEN" "$(format_london_time "2025-11-07" "15:30:00")" "[\"${SERVICE_IDS[2]}\"]" "" "Nov 7 - Luxury Pedicure"
|
||||
create_booking "$USER_TOKEN" "$(format_london_time "2025-11-09" "09:30:00")" "[\"${SERVICE_IDS[0]}\",\"${SERVICE_IDS[5]}\"]" "" "Nov 9 - Classic + Nail Art"
|
||||
create_booking "$USER_TOKEN" "$(format_london_time "2025-11-11" "13:00:00")" "[\"${SERVICE_IDS[1]}\"]" "" "Nov 11 - Gel Manicure"
|
||||
create_booking "$USER_TOKEN" "$(format_london_time "2025-11-12" "16:00:00")" "[\"${SERVICE_IDS[4]}\"]" "" "Nov 12 - Gel Removal"
|
||||
create_booking "$USER_TOKEN" "$(format_london_time "2025-11-14" "10:30:00")" "[\"${SERVICE_IDS[0]}\"]" "" "Nov 14 - Classic Manicure"
|
||||
create_booking "$USER_TOKEN" "$(format_london_time "2025-11-16" "14:30:00")" "[\"${SERVICE_IDS[3]}\"]" "" "Nov 16 - Express Mani & Pedi"
|
||||
create_booking "$USER_TOKEN" "$(format_london_time "2025-11-18" "11:00:00")" "[\"${SERVICE_IDS[2]}\"]" "" "Nov 18 - Luxury Pedicure"
|
||||
create_booking "$USER_TOKEN" "$(format_london_time "2025-11-19" "15:00:00")" "[\"${SERVICE_IDS[1]}\",\"${SERVICE_IDS[5]}\"]" "" "Nov 19 - Gel + Nail Art"
|
||||
create_booking "$USER_TOKEN" "$(format_london_time "2025-11-21" "09:00:00")" "[\"${SERVICE_IDS[0]}\"]" "" "Nov 21 - Classic Manicure"
|
||||
create_booking "$USER_TOKEN" "$(format_london_time "2025-11-22" "13:30:00")" "[\"${SERVICE_IDS[1]}\"]" "" "Nov 22 - Gel Manicure"
|
||||
create_booking "$USER_TOKEN" "$(format_london_time "2025-11-23" "16:30:00")" "[\"${SERVICE_IDS[4]}\",\"${SERVICE_IDS[0]}\"]" "" "Nov 23 - Removal + Classic"
|
||||
create_booking "$USER_TOKEN" "$(format_london_time "2025-11-25" "10:00:00")" "[\"${SERVICE_IDS[3]}\"]" "" "Nov 25 - Express Mani & Pedi"
|
||||
create_booking "$USER_TOKEN" "$(format_london_time "2025-11-26" "14:00:00")" "[\"${SERVICE_IDS[2]}\"]" "" "Nov 26 - Luxury Pedicure"
|
||||
create_booking "$USER_TOKEN" "$(format_london_time "2025-11-27" "11:30:00")" "[\"${SERVICE_IDS[0]}\",\"${SERVICE_IDS[5]}\"]" "" "Nov 27 - Classic + Nail Art"
|
||||
create_booking "$USER_TOKEN" "$(format_london_time "2025-11-28" "15:30:00")" "[\"${SERVICE_IDS[1]}\"]" "" "Nov 28 - Gel Manicure"
|
||||
create_booking "$USER_TOKEN" "$(format_london_time "2025-11-29" "09:30:00")" "[\"${SERVICE_IDS[0]}\"]" "" "Nov 29 - Classic Manicure"
|
||||
create_booking "$USER_TOKEN" "$(format_london_time "2025-11-29" "13:00:00")" "[\"${SERVICE_IDS[3]}\"]" "Last one before December!" "Nov 29 - Express Mani & Pedi"
|
||||
|
||||
# --- FUTURE BOOKINGS (6 bookings) ---
|
||||
echo ""
|
||||
echo "Creating 6 future bookings..."
|
||||
|
||||
# Get tomorrow at 08:00 London time as base (ensures future)
|
||||
TOMORROW_BASE=$(TZ=Europe/London date -d "tomorrow 08:00" +%Y-%m-%d)
|
||||
|
||||
# Calculate future dates in London time
|
||||
NEXT_WEEK_DATE=$(TZ=Europe/London date -d "$TOMORROW_BASE +7 days" +%Y-%m-%d)
|
||||
WEEK_AFTER_DATE=$(TZ=Europe/London date -d "$TOMORROW_BASE +14 days" +%Y-%m-%d)
|
||||
|
||||
# Create demo bookings using London time with proper offset
|
||||
create_booking "$USER_TOKEN" "$(format_london_time "$TOMORROW_BASE" "10:00:00")" "[\"${SERVICE_IDS[0]}\"]" "" "Classic Manicure - Tomorrow 10:00"
|
||||
create_booking "$USER_TOKEN" "$(format_london_time "$TOMORROW_BASE" "14:30:00")" "[\"${SERVICE_IDS[1]}\",\"${SERVICE_IDS[5]}\"]" "Want French manicure with simple nail art on accent fingers" "Gel Manicure + Nail Art - Tomorrow 14:30"
|
||||
@@ -385,4 +432,4 @@ tmux select-pane -t $SESSION_NAME:0.0
|
||||
trap 'rm -f /tmp/seed_data.sh' EXIT
|
||||
|
||||
# Attach to session
|
||||
tmux attach-session -t $SESSION_NAME
|
||||
tmux attach-session -t $SESSION_NAME
|
||||
|
||||
Reference in New Issue
Block a user