Implements backend infrastructure for loading artist profiles from Cloudflare D1 database instead of static data. Database Changes: - Add slug column migration for SEO-friendly URLs (0001_add_artist_slug.sql) - Enhanced data migration script with slug generation - Support for all artist fields from data/artists.ts Type Definitions: - Add slug field to Artist interface - Create ArtistWithPortfolio type for full artist data - Create PublicArtist type for sanitized API responses - Add ArtistFilters type for query parameters - Add ArtistDashboardStats for analytics Database Functions (lib/db.ts): - getPublicArtists() - fetch active artists with portfolio and filtering - getArtistWithPortfolio() - fetch single artist with full portfolio - getArtistBySlug() - fetch by URL-friendly slug - getArtistByUserId() - fetch by user ID for dashboard - Enhanced getArtists() with JSON parsing API Endpoints: - Updated GET /api/artists - filtering, pagination, portfolio images - Created GET /api/artists/[id] - fetch by ID or slug - Created PUT /api/artists/[id] - update with authorization - Created DELETE /api/artists/[id] - soft delete (admin only) - Created GET /api/artists/me - current artist profile React Hooks (hooks/use-artist-data.ts): - useArtists() - fetch with filtering - useArtist() - fetch single artist - useCurrentArtist() - logged-in artist - useUpdateArtist(), useCreateArtist(), useDeleteArtist() - mutations Frontend Components: - Refactored artists-grid.tsx to use API with loading/error states - Use database field names (slug, specialties, portfolioImages) - Display profile images from portfolio - Client-side filtering by specialty Files Modified: - sql/migrations/0001_add_artist_slug.sql (new) - types/database.ts (enhanced) - lib/data-migration.ts (enhanced) - lib/db.ts (enhanced) - app/api/artists/route.ts (updated) - app/api/artists/[id]/route.ts (new) - app/api/artists/me/route.ts (new) - hooks/use-artist-data.ts (new) - components/artists-grid.tsx (refactored) Remaining work: Artist portfolio page, artist dashboard, admin enhancements Ref: artist_profile_refactor_implementation_plan.md
44 lines
938 B
TOML
44 lines
938 B
TOML
name = "united-tattoo"
|
|
compatibility_date = "2024-09-23"
|
|
compatibility_flags = ["nodejs_compat"]
|
|
main = ".open-next/worker.js"
|
|
|
|
[assets]
|
|
directory = ".open-next/assets"
|
|
binding = "ASSETS"
|
|
|
|
# D1 Database binding
|
|
[[d1_databases]]
|
|
binding = "DB"
|
|
database_name = "united-tattoo"
|
|
database_id = "7191a4c4-e3b2-49c6-bd8d-9cc3394977ec"
|
|
|
|
# R2 bucket binding
|
|
[[r2_buckets]]
|
|
binding = "R2_BUCKET"
|
|
bucket_name = "united-tattoo"
|
|
|
|
# R2 bucket for OpenNext incremental cache
|
|
[[r2_buckets]]
|
|
binding = "NEXT_INC_CACHE_R2_BUCKET"
|
|
bucket_name = "united-tattoo-inc-cache"
|
|
|
|
[[services]]
|
|
binding = "WORKER_SELF_REFERENCE"
|
|
service = "united-tattoo"
|
|
|
|
# Environment variables for production
|
|
[env.production.vars]
|
|
NEXTAUTH_URL = "https://united-tattoos.com"
|
|
NODE_ENV = "production"
|
|
|
|
# Environment variables for preview
|
|
[env.preview.vars]
|
|
NEXTAUTH_URL = "https://united-tattoos.com"
|
|
NODE_ENV = "production"
|
|
|
|
[dev]
|
|
ip = "0.0.0.0"
|
|
port = 8787
|
|
local_protocol = "http"
|