Commit Graph

14 Commits

Author SHA1 Message Date
60fed6d464 Implement performance improvements across backend and frontend
- models.py: add composite (user_id, date) indexes to flock_history,
  feed_purchases, and other_purchases for faster date-filtered queries
  (egg_collections already had one via its unique constraint)
- main.py: add v2.2 migration to create the three composite indexes on
  existing installs at startup
- stats.py: fix N+1 query in monthly_stats — flock history is now fetched
  once and looked up per month using bisect_right instead of one DB query
  per month row; also remove unnecessary Decimal(str(...)) round-trips
  since SQLAlchemy already returns Numeric columns as Decimal
- eggs.py: add limit parameter (default 500, max 1000) to list_eggs to
  cap unbounded fetches on large datasets
- dashboard.js: pass start= (30 days ago) when fetching eggs so the
  dashboard only loads the data it actually needs for the chart and
  recent collections list

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 00:02:58 -07:00
37f19a83ed Implement security hardening across frontend, backend, and infrastructure
- nginx: add X-Content-Type-Options, X-Frame-Options, X-XSS-Protection,
  and Referrer-Policy headers on all responses; rate limit /api/auth/login
  to 5 req/min per IP (burst 3) to prevent brute force
- frontend: add escHtml() utility to api.js; use it on all notes fields
  across dashboard, log, history, flock, and budget pages to prevent XSS
- log.js: fix broken loadRecent() call referencing removed #recent-body
  element; replaced with loadHistory() from history.js
- schemas.py: raise minimum password length from 6 to 10 characters
- admin.py: add audit logging for password reset, disable, delete, and
  impersonate actions; fix impersonate to use named admin param for logging
- main.py: add startup env validation — exits with clear error if any
  required env var is missing; configure structured logging to stdout
- docker-compose.yml: add log rotation (10 MB / 3 files) to all services

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-17 23:55:08 -07:00
b660263f30 Merge History into Log Eggs page; update dashboard card order and colors
- Removed standalone History page (history.html); full collection history
  (date filter, edit, delete, totals footer) is now embedded in the Log
  Eggs page below the log form
- Removed History nav link from all pages
- Reordered dashboard stat cards: egg counts → averages → Flock Size →
  cost cards
- Egg count and average cards now use green; Flock Size card uses orange
- Updated README to reflect removed History page, merged log/history
  feature, dashboard card changes, and project structure

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-17 23:43:27 -07:00
31dd106ebd Add .env.example
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-17 23:22:26 -07:00
4d94e716e7 Add egg emoji to README title
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-17 23:21:20 -07:00
58c138d647 Update clone URL to yolkbook repo name
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-17 23:20:21 -07:00
aa12648228 Add multi-user auth, admin panel, and timezone support; rename to Yolkbook
- Rename app from Eggtracker to Yolkbook throughout
- Add JWT-based authentication (python-jose, passlib/bcrypt)
- Add users table; all data tables gain user_id FK for full data isolation
- Super admin credentials sourced from ADMIN_USERNAME/ADMIN_PASSWORD env vars,
  synced on every startup; orphaned rows auto-assigned to admin post-migration
- Login page with self-registration; JWT stored in localStorage (30-day expiry)
- Admin panel (/admin): list users, reset passwords, disable/enable, delete,
  and impersonate (Login As) with Return to Admin banner
- Settings modal (gear icon in nav): timezone selector and change password
- Timezone stored per-user; stats date windows computed in user's timezone;
  date input setToday() respects user timezone via Intl API
- migrate_v2.sql for existing single-user installs
- Auto-migration adds timezone column to users on startup
- Updated README with full setup, auth, admin, and migration docs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-17 23:19:29 -07:00
7d50af0054 Show cost per egg as 2 decimal places on dashboard
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-26 22:57:22 -08:00
5bc874a924 Show cost per egg as 2 decimal places on summary page
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-26 22:55:21 -08:00
b633586012 Show cost per egg as 2 decimal places
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-26 22:53:09 -08:00
404fd0510f Add Other Purchases to budget page
- New other_purchases table (date, total, notes)
- /api/other CRUD endpoints
- Budget stats now include other costs in cost/egg and cost/dozen math
- Budget page: new Log Other Purchases form, stat cards for other costs,
  combined Purchase History table showing feed and other entries together

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-26 22:47:57 -08:00
ceb0780663 Add README
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-26 22:29:55 -08:00
492e1fd68f Initial commit
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-26 22:27:58 -08:00
4387f6df92 Initial commit 2026-02-26 22:25:21 -08:00