Commit Graph

89 Commits

Author SHA1 Message Date
0bc6d8226e fix: remove problematic DATE() index from api_usage table
PostgreSQL requires functions in indexes to be marked IMMUTABLE.
Removed idx_api_usage_user_date composite index that used DATE().
Remaining indexes (user_id, api_type, created_at) still provide
good query performance for daily limit checks.
2025-12-18 13:59:14 +01:00
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
334bece471 feat: implement comprehensive i18n system with German and English support
- Created type-safe i18n system with TranslationKeys interface
- Added German (de) and English (en) translations with 160+ keys
- Implemented I18nContext provider and useI18n hook
- Added LanguageSwitcher component for language selection
- Refactored all major components to use translations:
  * Home page, StatsDashboard, DramOfTheDay
  * BottleGrid, EditBottleForm, CameraCapture
  * BuddyList, SessionList, TastingNoteForm
  * StatusSwitcher and bottle management features
- Implemented locale-aware currency formatting (EUR)
- Implemented locale-aware date formatting
- Added localStorage persistence for language preference
- Added automatic browser language detection
- Organized translations into 8 main categories
- System is extensible for additional languages
2025-12-18 13:44:48 +01:00
acf02a78dd feat: enhance bottle metadata with distillation/bottling dates and batch info 2025-12-18 13:24:41 +01:00
61a7966579 refactor: use GEMINI_API_KEY for Google Search as well 2025-12-18 12:59:35 +01:00
ddf352dab6 feat: switch Whiskybase discovery to Google Custom Search JSON API 2025-12-18 12:43:48 +01:00
fef1c4a275 feat: implement automated Whiskybase ID discovery 2025-12-18 12:40:57 +01:00
35c2443473 feat: implement QOL features (Stats, Search, Dram of the Day) 2025-12-18 12:34:51 +01:00
7d395392d1 nix standalone 2025-12-18 12:22:34 +01:00
970dabbbf6 feat: add bottle editing and purchase price tracking 2025-12-18 12:16:01 +01:00
6e09300bab feat: enforce 12-hour limit for active tasting sessions 2025-12-18 12:12:20 +01:00
e3af71c584 feat: complete bottle-to-session integration flow 2025-12-18 12:08:24 +01:00
a4b7045200 feat: re-introduce regression testing suite with pnpm 2025-12-18 12:03:24 +01:00
d386bb9825 feat: add HEIC image support for iPhone uploads 2025-12-18 12:01:31 +01:00
e339585e3a fix: restore missing imports in CameraCapture 2025-12-18 11:52:07 +01:00
5f757d7b56 feat: implement Save & Taste flow in CameraCapture 2025-12-18 11:49:40 +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
e6974cd060 fix: resolve collection fetch race condition and improve tasting deletion UI 2025-12-18 11:17:22 +01:00
d07af05b66 feat: implement buddies and tasting sessions features 2025-12-18 10:56:41 +01:00
314967b31b fix: resolve mobile UI issues (scrollbar and overlapping form) 2025-12-18 10:04:11 +01:00
330c8e1cc0 feat: optimize layout for mobile devices (Pixel 9 Pro) 2025-12-18 09:59:31 +01:00
9ba1f8bd56 fix: corect layout spacing and restore filter functionality 2025-12-18 09:52:07 +01:00
a3aa4f8b25 fix: restore BottleGrid and apply storage URL normalization 2025-12-18 09:36:13 +01:00
689dddd1ac chore: restore safe middleware session logic 2025-12-18 09:21:19 +01:00
f600360505 chore: deployment debugging - minimal middleware, health api, and nextjs upgrade 2025-12-18 09:14:13 +01:00
8c5d931b6e chore: stop tracking .next directory 2025-12-18 09:09:42 +01:00
1a0a132182 chore: revert standalone output and harden home page auth check 2025-12-18 09:06:57 +01:00
56178cea81 chore: deployment debugging - output standalone and global error boundary 2025-12-18 09:00:59 +01:00
2f02e7a744 chore: add sharp for production image optimization 2025-12-18 08:51:31 +01:00
728d53c121 chore: fix deployment eval error and add middleware safety checks 2025-12-18 00:48:13 +01:00
77814ea3cd pnmp 2025-12-18 00:39:56 +01:00
a41a72fb0d eval fix 2025-12-18 00:32:45 +01:00
52da147761 chore: remove .env.local from git 2025-12-18 00:20:24 +01:00
6f08bb3c4c feat: implement offline queue, background sync and AI robustness 2025-12-17 23:25:12 +01:00
fe82d52a85 style: polish bottle cards with premium aesthetic and better readability 2025-12-17 23:20:34 +01:00
939d69a634 feat: add tasting sorting and polish UI with premium aesthetic 2025-12-17 23:18:07 +01:00
19689ffd2f feat: implement PWA, manifest, service worker and offline indicator 2025-12-17 23:15:51 +01:00
5807d949ef init 2025-12-17 23:12:53 +01:00