- Admin CRUD endpoints for markets with role-based middleware - Anonymous market submission with Cloudflare Turnstile verification - SMTP email notifications on new submissions (LogSender fallback) - Market status workflow (pending/approved/rejected) with admin notes - Nullable location column for submissions without coordinates - CLI tool for promoting users to admin role - Slug generation package extracted from seed - Rate limiting on submission endpoint (3/hour per IP) - Mailpit added to docker-compose for local email testing
65 lines
1.4 KiB
Makefile
65 lines
1.4 KiB
Makefile
set dotenv-load
|
|
|
|
default:
|
|
@just --list
|
|
|
|
# Start local dev infrastructure (Postgres + Valkey)
|
|
dev:
|
|
docker compose -f deploy/docker-compose.yml up -d
|
|
|
|
# Stop local dev infrastructure
|
|
dev-down:
|
|
docker compose -f deploy/docker-compose.yml down
|
|
|
|
# Run database migrations
|
|
migrate:
|
|
go run -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@latest \
|
|
-path migrations \
|
|
-database "postgres://${DB_USER}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_NAME}?sslmode=${DB_SSLMODE}" \
|
|
up
|
|
|
|
# Rollback last migration
|
|
migrate-down:
|
|
go run -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@latest \
|
|
-path migrations \
|
|
-database "postgres://${DB_USER}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_NAME}?sslmode=${DB_SSLMODE}" \
|
|
down 1
|
|
|
|
# Seed sample market data
|
|
seed:
|
|
go run ./cmd/seed
|
|
|
|
# Run the API server
|
|
run:
|
|
go run ./cmd/api
|
|
|
|
# Run all tests
|
|
test:
|
|
go test ./... -v -count=1
|
|
|
|
# Run tests with coverage
|
|
test-cover:
|
|
go test ./... -v -count=1 -coverprofile=coverage.out
|
|
go tool cover -html=coverage.out -o coverage.html
|
|
|
|
# Run linter
|
|
lint:
|
|
golangci-lint run ./...
|
|
|
|
# Format code
|
|
fmt:
|
|
gofmt -w .
|
|
goimports -w .
|
|
|
|
# Build the API binary
|
|
build:
|
|
go build -o api ./cmd/api
|
|
|
|
# Promote a user to admin by email
|
|
promote-admin email:
|
|
go run ./cmd/admin promote {{email}}
|
|
|
|
# Clean build artifacts
|
|
clean:
|
|
rm -f api coverage.out coverage.html
|