Skip to main content

Staging Database Setup

Single Script Approachโ€‹

We now have one consolidated script that seeds the entire staging database with all required entities.

๐Ÿ“ Script Locationโ€‹

src/app/api/init-staging-complete/route.ts

๐ŸŽฏ What It Seedsโ€‹

The consolidated script automatically seeds:

  1. ๐Ÿ‘ฅ Users (27 total)

    • 3 Admin users (with permissions, departments)
    • 6 Guardian users (with rescue experience, specialties)
    • 12 Regular users (with donation stats)
    • 3 Investor users
    • 3 Partner users
    • 4 Waitlist users
    • 2 Waitlist guardians
  2. ๐Ÿ†˜ Cases (10 total)

    • Pet rescue cases with Firebase Storage images
    • Complete case details (medical needs, adoption status, etc.)
    • Linked to guardian users
  3. ๐Ÿ‘ฅ Follows (User subscriptions to cases)

    • Each user follows 2-5 cases
    • Realistic follow relationships
  4. ๐Ÿ’ฐ Donations (36 total)

    • Stellar wallet integration with MoonPay
    • ARS and USD currencies with conversion to XLM
    • Case-based and direct guardian donations
    • Automatic user stats calculation

๐Ÿš€ Usageโ€‹

Start the development server:

npm run dev

Seed the staging database:

# PowerShell
Invoke-WebRequest -Uri "http://localhost:5000/api/init-staging-complete" -Method POST -ContentType "application/json"

# cURL
curl -X POST http://localhost:5000/api/init-staging-complete -H "Content-Type: application/json"

๐Ÿ“Š Expected Resultsโ€‹

After running the script, you should see:

  • โœ… 27 users with complete profiles and donation stats
  • โœ… 10 cases with Firebase Storage images
  • โœ… 36 donations with Stellar wallet integration
  • โœ… Follow relationships between users and cases
  • โœ… All user fields populated (donationCount, totalDonated, lastActive, location)

๐Ÿ”ง Featuresโ€‹

  • Firebase Storage Images: All cases have proper Firebase Storage image URLs
  • Stellar Wallet Integration: Donations use MoonPay with ARS/USD to XLM conversion
  • Realistic Data: All data is realistic and follows the platform's business logic
  • Complete User Profiles: All users have all required fields for proper UI display
  • Automatic Stats: User donation stats are calculated automatically from donations

๐Ÿงน Cleanupโ€‹

The old individual scripts have been removed:

  • โŒ init-staging
  • โŒ init-comprehensive-staging
  • โŒ init-staging-with-images
  • โŒ init-donations-staging

Only use the consolidated script: /api/init-staging-complete