Commit Graph

10 Commits

Author SHA1 Message Date
dd27cfe0e7 feat: implement API usage tracking and admin dashboard
- Added database schema for API tracking system:
  * api_usage table - tracks all Google Search and Gemini AI calls
  * user_credits table - prepared for future credits system
  * admin_users table - controls admin dashboard access
- Created comprehensive tracking service (track-api-usage.ts):
  * trackApiUsage() - records API calls with success/failure
  * checkDailyLimit() - enforces 80 Google Search calls/day limit
  * getUserApiStats() - per-user statistics
  * getGlobalApiStats() - app-wide statistics (admin only)
  * checkIsAdmin() - server-side authorization
- Integrated tracking into discover-whiskybase.ts:
  * Pre-call limit checking with friendly error messages
  * Post-call usage tracking for success and failures
  * User authentication verification
- Built admin dashboard at /admin:
  * Global statistics cards (total, today, by API type)
  * Top 10 users by API usage
  * Recent activity log with 50 latest calls
  * Color-coded status indicators
  * Secure access with RLS policies
- Features:
  * Daily limit resets at midnight Europe/Berlin timezone
  * Graceful error handling (allows on tracking failure)
  * Comprehensive indexes for fast queries
  * Ready for future credits/monetization system
2025-12-18 13:56:21 +01:00
acf02a78dd feat: enhance bottle metadata with distillation/bottling dates and batch info 2025-12-18 13:24:41 +01:00
35c2443473 feat: implement QOL features (Stats, Search, Dram of the Day) 2025-12-18 12:34:51 +01:00
970dabbbf6 feat: add bottle editing and purchase price tracking 2025-12-18 12:16:01 +01:00
2685176992 chore: clean up diagnostic logs and update walkthrough 2025-12-18 11:32:16 +01:00
5923dd0474 fix: resolve RLS infinite recursion in tastings and sessions 2025-12-18 11:24:04 +01:00
d07af05b66 feat: implement buddies and tasting sessions features 2025-12-18 10:56:41 +01:00
330c8e1cc0 feat: optimize layout for mobile devices (Pixel 9 Pro) 2025-12-18 09:59:31 +01:00
6f08bb3c4c feat: implement offline queue, background sync and AI robustness 2025-12-17 23:25:12 +01:00
5807d949ef init 2025-12-17 23:12:53 +01:00