#!/bin/bash
# Test script to generate time clock aggregates

PHPSESSID="d39e7c4fef5dc152c3f222a2ce30da7a"
BASE_URL="http://localhost:8080"

echo "=== Testing Time Clock Aggregate Generation ==="
echo ""

# Test 1: Generate aggregates for July 2025
echo "1. Generating aggregates for July 2025..."
curl -s -X GET "${BASE_URL}/api/time_clock_aggregates/generate?start_date=2025-07-01&end_date=2025-07-31" \
  -b "PHPSESSID=${PHPSESSID}" \
  -H "Accept: application/json" | jq .

echo ""
echo "=== Fetching generated aggregates ==="
echo ""

# Test 2: Fetch the aggregates we just created
curl -s "${BASE_URL}/api/sync/pull?tables%5Btime_clock_aggregates%5D=" \
  -b "PHPSESSID=${PHPSESSID}" \
  -H "Accept: application/json" | jq .

echo ""
echo "=== Done ===" 
