Files

78 lines
1.6 KiB
Bash
Raw Permalink Normal View History

#!/usr/bin/env bash
set -e
BASE_URL="http://127.0.0.1:5000"
echo "======================================="
echo "Fetching users"
echo "======================================="
curl -s \
"${BASE_URL}/api/users" \
| jq .
echo
echo "======================================="
echo "Clocking IN user 1"
echo "======================================="
curl -s \
-X POST \
-H "Content-Type: application/json" \
-d '{
"user_id": 1,
"entrytype": "in",
"timestamp": "2026-05-29T08:00:00-04:00"
}' \
"${BASE_URL}/api/entries" \
| jq .
sleep 1
echo
echo "======================================="
echo "Clocking OUT user 1"
echo "======================================="
curl -s \
-X POST \
-H "Content-Type: application/json" \
-d '{
"user_id": 1,
"entrytype": "out",
"timestamp": "2026-05-29T17:00:00-04:00"
}' \
"${BASE_URL}/api/entries" \
| jq .
echo
echo "======================================="
echo "Fetching entries"
echo "======================================="
curl -s \
"${BASE_URL}/api/entries" \
| jq .
echo
echo "======================================="
echo "Generating report through web form"
echo "======================================="
curl -s \
-X POST \
-d "user_id=1" \
-d "action=report" \
-d "begin_date=2026-05-22T00:00:00-04:00" \
-d "end_date=2026-05-29T23:59:59-04:00" \
"${BASE_URL}/" \
> report.html
echo "Report saved to report.html"
echo
echo "======================================="
echo "Done"
echo "======================================="