mirror of
https://github.com/bitbaum/evig.git
synced 2026-12-04 08:17:20 +01:00
Implements comprehensive P2P marketplace with instant listing creation, in-app messaging, seller profiles, reviews, and smart search. **Phase 1: Core Marketplace MVP (Tasks 1-6)** Database (Migration 031): - listings table (SSOT for all products): seller_id, title, price, category, condition, delivery/payment options, German full-text search - seller_profiles table (auto-created on first listing) - listing_images table (up to 8 images per listing) - listing_favorites table (wishlist functionality) - marketplace_orders table (for Phase 3) Config & Schemas: - src/config/marketplace.ts: MARKETPLACE_CATEGORIES, LISTING_STATUSES, DELIVERY_OPTIONS, PAYMENT_MODES, SORT_OPTIONS, CONDITIONS, MARKETPLACE_LIMITS - src/config/database.ts: Add TABLE_NAMES for new tables - src/lib/schemas/marketplace.ts: ListingsQuerySchema, CreateListingSchema, UpdateListingSchema, ContactSellerSchema API Routes: - GET/POST /api/listings: Public browse with filters + create listing - GET/PATCH/DELETE /api/listings/[id]: Detail, update, soft delete - POST /api/listings/[id]/favorite: Toggle favorite - GET /api/listings/mine: My listings with status filter Pages: - /marketplace: Browse with search, filters, pagination, grid layout - /marketplace/[id]: Detail page with image gallery, seller info, actions - /marketplace/sell: Create listing with two-step flow (form → preview) - /dashboard/listings: My listings management **Phase 2: Trust & Discovery (Tasks 7-16)** Messaging Integration (Migration 032): - POST /api/listings/[id]/contact: Create conversation tied to listing - Updated conversation types to include 'marketplace' Seller Profiles: - GET /api/sellers/[id]: Public seller profile + active listings + reviews - GET/PATCH /api/sellers/me: Own seller profile management - /sellers/[id]: Public seller profile page - /dashboard/profile/seller: Edit seller profile Edit Flow: - Updated /marketplace/sell to handle edit mode via ?edit=ID param Reviews: - ListingReviews component: Display reviews on listing detail - ReviewForm component: Submit reviews with ratings - Reuses existing review system with target_type='listing' Meilisearch Integration: - src/lib/search/meilisearch.ts: Client + index management - POST /api/search/listings: Search with facets and filters - scripts/reindex-listings.ts: One-time indexing script - Auto-index on create/update/delete Email Notifications: - src/lib/email/templates/marketplace.ts: Listing published, new message, review notification, status updates Image Optimization: - Updated /api/uploads to generate thumbnail + medium sizes with sharp Advanced Features: - GET /api/listings/similar: Similar listings suggestions - GET /api/listings/favorites: User's favorited listings - /dashboard/favorites: Favorites dashboard **Key Architecture:** - No seller approval gate - instant listing creation - Two payment modes: 'secure' (Stripe escrow, 5% commission) or 'direct' (contact seller) - Delivery options: 'pickup', 'shipping', or 'both' - In-app messaging (no mailto links) - Meilisearch for fast, typo-tolerant search with facets - Image optimization with sharp (thumbnail + medium sizes) - Swiss German UI throughout **Cleanup:** - Add "Verkaufen" to main navigation - Add /dashboard/listings to dashboard sidebar - Deprecate old /api/marketplace/products routes - Remove requireSeller() gate Verified: tsc --noEmit (zero errors), npm run lint (zero errors) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>