📤 Avatar Upload API (/api/user/avatar): - File upload with multipart form data parsing - Comprehensive validation (file type, size limits) - Support for JPEG, PNG, GIF, WebP images up to 5MB - Automatic cleanup of old avatars before new uploads - Vercel Blob integration with public access - Database tracking in user_avatars table - Error handling for upload failures 🎨 Avatar Generation API (/api/user/avatar/generate): - Custom avatar generation using DiceBear API - Fire-themed color scheme (matching app branding) - Personalized based on user initials/username/email - SVG format for crisp display at any size - Automatic fallback if generation fails - Same cleanup and storage workflow as uploads 🗑️ Account Deletion API (/api/user/delete): - Complete user data cleanup including Vercel Blob files - Cascading deletion respecting foreign key constraints - Admin account protection (prevents self-deletion) - Comprehensive cleanup order: * User avatars from Vercel Blob storage * Deck cards, decks, collection cards, collections * User cards, avatar records, settings * Finally the user account itself - Detailed logging for audit trail - Graceful error handling with specific error messages 🔧 Technical Features: - Custom multipart form data parser for file uploads - Vercel Blob put/del operations with error handling - Unique filename generation with timestamps - Database transaction-like cleanup for deletions - File type validation and size limits - Proper CORS headers for all endpoints 🎯 Integration Ready: - Works seamlessly with existing profile page UI - Supports both upload and generate avatar buttons - Returns avatar URLs for immediate display - Database consistency with user profile system - Production-ready error handling and validation The avatar system is now fully functional with Vercel Blob! 📸✨
41 lines
1.1 KiB
JSON
41 lines
1.1 KiB
JSON
{
|
|
"name": "tcg-vault",
|
|
"version": "0.1.0",
|
|
"private": true,
|
|
"type": "module",
|
|
"scripts": {
|
|
"dev": "next dev",
|
|
"build": "next build",
|
|
"start": "next start",
|
|
"lint": "next lint",
|
|
"setup-db": "node scripts/setup-neon-db.js",
|
|
"import-popular": "node scripts/import-popular-sets.js",
|
|
"import-all": "node scripts/bulk-import-all.js"
|
|
},
|
|
"dependencies": {
|
|
"@neondatabase/serverless": "^1.0.1",
|
|
"@vercel/blob": "^1.1.1",
|
|
"@vercel/postgres": "^0.10.0",
|
|
"bcryptjs": "^3.0.2",
|
|
"dotenv": "^17.2.1",
|
|
"jsonwebtoken": "^9.0.2",
|
|
"next": "^15.4.2",
|
|
"node-fetch": "^3.3.2",
|
|
"react": "^18.3.1",
|
|
"react-dom": "^18.3.1",
|
|
"resend": "^4.7.0"
|
|
},
|
|
"devDependencies": {
|
|
"@types/bcryptjs": "^2.4.6",
|
|
"@types/jsonwebtoken": "^9.0.10",
|
|
"@types/node": "^16.18.126",
|
|
"@types/react": "^18.3.17",
|
|
"@types/react-dom": "^18.3.5",
|
|
"autoprefixer": "^10.4.21",
|
|
"eslint": "^8",
|
|
"eslint-config-next": "15.4.2",
|
|
"postcss": "^8.5.6",
|
|
"tailwindcss": "^3.4.17",
|
|
"typescript": "^4.9.5"
|
|
}
|
|
}
|