From bf701f83423006035cd3c435f27a6f5f1c712165 Mon Sep 17 00:00:00 2001 From: Frank John Begornia Date: Sun, 16 Nov 2025 01:19:35 +0800 Subject: [PATCH] Replace Firebase Storage with MinIO and add user account features - Storage Integration: * Remove Firebase Storage dependency and useFirebaseStorage composable * Implement direct MinIO uploads via POST /storage/upload with multipart/form-data * Upload canvas JSON, preview PNG, and production PNG as separate objects * Store public URLs and metadata in design records - Authentication & Registration: * Add email/password registration page with validation * Integrate backend user session via /auth/login endpoint * Store backendUser.id as ownerId in design records * Auto-sync backend session on Firebase auth state changes - User Account Pages: * Create profile page showing user details and backend session info * Create orders page with transaction history filtered by customerEmail * Add server proxy /api/orders to forward GET /transactions queries - Navigation Improvements: * Replace inline auth buttons with avatar dropdown menu * Add Profile, Orders, and Logout options to dropdown * Implement outside-click and route-change handlers for dropdown * Display user initials in avatar badge - API Updates: * Update transactions endpoint to accept amount as string * Format amount with .toFixed(2) in checkout success flow * Query orders by customerEmail instead of ownerId for consistency --- .env.example | 4 +- app/components/AppNavbar.vue | 119 ++++++- app/components/LoginModal.vue | 11 + app/components/designer/TemplatePicker.vue | 4 +- app/composables/useAuth.ts | 351 ++++++++++++++------- app/composables/useFirebaseStorage.ts | 1 + app/pages/checkout/success.vue | 235 ++++++++++++++ app/pages/index.vue | 280 ++++++++++++++-- app/pages/orders.vue | 227 +++++++++++++ app/pages/profile.vue | 156 +++++++++ app/pages/register.vue | 186 +++++++++++ composables/useSlipmatDesigner.ts | 105 +++++- nuxt.config.ts | 3 +- server/api/checkout.session.post.ts | 60 ++-- server/api/checkout/[sessionId].get.ts | 62 ++++ server/api/designs.post.ts | 60 ++++ server/api/designs/[designId].get.ts | 30 ++ server/api/orders.get.ts | 43 +++ server/api/transactions.post.ts | 93 ++++-- 19 files changed, 1807 insertions(+), 223 deletions(-) create mode 100644 app/composables/useFirebaseStorage.ts create mode 100644 app/pages/checkout/success.vue create mode 100644 app/pages/orders.vue create mode 100644 app/pages/profile.vue create mode 100644 app/pages/register.vue create mode 100644 server/api/checkout/[sessionId].get.ts create mode 100644 server/api/designs.post.ts create mode 100644 server/api/designs/[designId].get.ts create mode 100644 server/api/orders.get.ts diff --git a/.env.example b/.env.example index d3f11ed..1fbd7ed 100644 --- a/.env.example +++ b/.env.example @@ -3,6 +3,7 @@ NUXT_PUBLIC_FIREBASE_API_KEY=your_firebase_api_key_here NUXT_PUBLIC_FIREBASE_AUTH_DOMAIN=your_firebase_auth_domain_here NUXT_PUBLIC_FIREBASE_PROJECT_ID=your_firebase_project_id_here +# Use the bucket ID (e.g. project-id.appspot.com), not the web URL. NUXT_PUBLIC_FIREBASE_STORAGE_BUCKET=your_firebase_storage_bucket_here NUXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=your_messaging_sender_id_here NUXT_PUBLIC_FIREBASE_APP_ID=your_firebase_app_id_here @@ -14,4 +15,5 @@ STRIPE_SECRET_KEY=sk_test_xxx STRIPE_WEBHOOK_SECRET=whsec_xxx # Backend Configuration -NUXT_PUBLIC_BACKEND_URL=http://localhost:3000 \ No newline at end of file +NUXT_PUBLIC_BACKEND_URL=http://localhost:3000 +NUXT_PUBLIC_STORAGE_URL=http://localhost:9000 \ No newline at end of file diff --git a/app/components/AppNavbar.vue b/app/components/AppNavbar.vue index d2bf42b..66b0786 100644 --- a/app/components/AppNavbar.vue +++ b/app/components/AppNavbar.vue @@ -1,41 +1,136 @@