Add PDF reports, file uploads, admin auth, and comprehensive tests

Features:
- PDF service for generating task reports with ReportLab-style formatting
- Storage service for file uploads (local and S3-compatible)
- Admin authentication middleware with JWT support
- Admin user model and repository

Infrastructure:
- Updated Docker configuration for admin panel builds
- Email service enhancements for task notifications
- Updated router with admin and file upload routes
- Environment configuration updates

Tests:
- Unit tests for handlers (auth, residence, task)
- Unit tests for models (user, residence, task)
- Unit tests for repositories (user, residence, task)
- Unit tests for services (residence, task)
- Integration test setup
- Test utilities for mocking database and services

Database:
- Admin user seed data
- Updated test data seeds

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Trey t
2025-11-27 23:36:20 -06:00
parent 2817deee3c
commit 469f21a833
50 changed files with 6795 additions and 582 deletions

48
dev.sh
View File

@@ -53,8 +53,9 @@ case "$1" in
echo "🔨 Building binaries locally..."
go build -o bin/api ./cmd/api
go build -o bin/worker ./cmd/worker
go build -o bin/admin ./cmd/admin
echo "✅ Binaries built in ./bin/"
echo "🔨 Building admin panel..."
cd admin && npm run build && cd ..
echo "✅ Binaries built in ./bin/, admin panel built in ./admin/.next/standalone/"
;;
run-api)
echo "🚀 Running API server locally..."
@@ -64,10 +65,6 @@ case "$1" in
echo "⚙️ Running worker locally..."
go run ./cmd/worker
;;
run-admin)
echo "🛠️ Running admin panel locally..."
go run ./cmd/admin
;;
db)
echo "🐘 Connecting to PostgreSQL..."
docker-compose $COMPOSE_FILES exec db psql -U ${POSTGRES_USER:-mycrib} -d ${POSTGRES_DB:-mycrib}
@@ -93,9 +90,27 @@ case "$1" in
echo "✅ All data seeded"
;;
seed-admin)
echo "🔐 Seeding GoAdmin tables..."
docker-compose $COMPOSE_FILES exec -T db psql -U ${POSTGRES_USER:-postgres} -d ${POSTGRES_DB:-mycrib} -f - < migrations/002_goadmin_tables.up.sql
echo "✅ GoAdmin tables seeded"
echo "🔐 Seeding admin user..."
docker-compose $COMPOSE_FILES exec -T db psql -U ${POSTGRES_USER:-postgres} -d ${POSTGRES_DB:-mycrib} -f - < seeds/003_admin_user.sql
echo "✅ Admin user seeded"
;;
admin-install)
echo "📦 Installing admin panel dependencies..."
cd admin && npm install
echo "✅ Admin panel dependencies installed"
;;
admin-dev)
echo "🚀 Starting admin panel in development mode..."
cd admin && npm run dev
;;
admin-build)
echo "🔨 Building admin panel..."
cd admin && npm run build
echo "✅ Admin panel built (standalone mode)"
;;
admin-logs)
echo "📋 Viewing admin panel logs..."
docker-compose $COMPOSE_FILES logs -f admin
;;
migrate)
echo "📊 Running database migrations..."
@@ -135,10 +150,9 @@ case "$1" in
echo " clean Stop containers and remove volumes"
echo ""
echo "Local Development:"
echo " build-local Build all binaries locally"
echo " run-api Run API server locally"
echo " build-local Build Go binaries + admin panel locally"
echo " run-api Run API server locally (port 8000)"
echo " run-worker Run worker locally"
echo " run-admin Run admin panel locally"
echo " test Run tests locally"
echo " test-docker Run tests in Docker"
echo " lint Run linter"
@@ -151,12 +165,18 @@ case "$1" in
echo " seed Seed lookup data (categories, priorities, etc.)"
echo " seed-test Seed test data (users, residences, tasks)"
echo " seed-all Seed all data (lookups + test data)"
echo " seed-admin Seed GoAdmin tables"
echo " seed-admin Seed admin user"
echo ""
echo "Admin Panel:"
echo " admin-install Install admin panel npm dependencies"
echo " admin-dev Start admin panel dev server (port 3000)"
echo " admin-build Build admin panel for production"
echo " admin-logs View admin panel container logs"
echo ""
echo "Services:"
echo " api - API server (port 8000)"
echo " admin - Admin panel (port 3000)"
echo " worker - Background job worker"
echo " admin - Admin panel (port 9000)"
echo " db - PostgreSQL database"
echo " redis - Redis cache"
echo " gorush - Push notification server"