Spaces:
Sleeping
Sleeping
| const mongoose = require('mongoose'); | |
| const User = require('./src/models/User'); | |
| const dotenv = require('dotenv'); | |
| dotenv.config(); | |
| const photographers = [ | |
| { | |
| email: 'rahul.s@example.com', | |
| password: 'password123', | |
| role: 'photographer', | |
| firstName: 'Rahul', | |
| lastName: 'Sharma', | |
| bio: 'Award-winning portrait and lifestyle photographer based in Hyderabad. Specialized in cinematic lighting and natural expressions.', | |
| profilePicture: 'https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?q=80&w=400&h=400&fit=crop', | |
| specialty: 'Portrait', | |
| price: 80, | |
| experience: 5, | |
| address: 'Banjara Hills, Hyderabad', | |
| location: { type: 'Point', coordinates: [78.4357, 17.4141] }, | |
| isVerified: true, | |
| recommendationScore: 95, | |
| rating: 4.9, | |
| reviewsCount: 24, | |
| portfolio: [ | |
| { type: 'image', url: 'https://images.unsplash.com/photo-1534528741775-53994a69daeb?q=80&w=600' }, | |
| { type: 'image', url: 'https://images.unsplash.com/photo-1506794778202-cad84cf45f1d?q=80&w=600' } | |
| ] | |
| }, | |
| { | |
| email: 'priya.m@example.com', | |
| password: 'password123', | |
| role: 'photographer', | |
| firstName: 'Priya', | |
| lastName: 'Mehta', | |
| bio: 'Capturing timeless moments for modern couples. Fine art wedding photography with a storyteller approach.', | |
| profilePicture: 'https://images.unsplash.com/photo-1494790108377-be9c29b29330?q=80&w=400&h=400&fit=crop', | |
| specialty: 'Wedding', | |
| price: 150, | |
| experience: 8, | |
| address: 'Jubilee Hills, Hyderabad', | |
| location: { type: 'Point', coordinates: [78.4069, 17.4299] }, | |
| isVerified: true, | |
| recommendationScore: 88, | |
| rating: 4.8, | |
| reviewsCount: 42, | |
| portfolio: [ | |
| { type: 'image', url: 'https://images.unsplash.com/photo-1511285560929-80b456fea0bc?q=80&w=600' }, | |
| { type: 'image', url: 'https://images.unsplash.com/photo-1520854221256-17451cc331bf?q=80&w=600' } | |
| ] | |
| }, | |
| { | |
| email: 'anita.k@example.com', | |
| password: 'password123', | |
| role: 'photographer', | |
| firstName: 'Anita', | |
| lastName: 'Kapoor', | |
| bio: 'Vibrant street and travel sessions. I love finding the "hidden gems" of the city.', | |
| profilePicture: 'https://images.unsplash.com/photo-1544005313-94ddf0286df2?q=80&w=400&h=400&fit=crop', | |
| specialty: 'Lifestyle', | |
| price: 45, | |
| experience: 3, | |
| address: 'Gachibowli, Hyderabad', | |
| location: { type: 'Point', coordinates: [78.3489, 17.4401] }, | |
| isVerified: false, | |
| recommendationScore: 72, | |
| rating: 4.7, | |
| reviewsCount: 12, | |
| portfolio: [ | |
| { type: 'image', url: 'https://images.unsplash.com/photo-1488161628813-04466f872be2?q=80&w=600' }, | |
| { type: 'image', url: 'https://images.unsplash.com/photo-1515886657613-9f3515b0c78f?q=80&w=600' } | |
| ] | |
| }, | |
| { | |
| email: 'vikram.v@example.com', | |
| password: 'password123', | |
| role: 'photographer', | |
| firstName: 'Vikram', | |
| lastName: 'Varma', | |
| bio: 'Professional architectural and commercial photography. High-end equipment and detailed post-processing.', | |
| profilePicture: 'https://images.unsplash.com/photo-1500648767791-00dcc994a43e?q=80&w=400&h=400&fit=crop', | |
| specialty: 'Architectural', | |
| price: 200, | |
| experience: 12, | |
| address: 'Hitech City, Hyderabad', | |
| location: { type: 'Point', coordinates: [78.3814, 17.4483] }, | |
| isVerified: true, | |
| recommendationScore: 92, | |
| rating: 5.0, | |
| reviewsCount: 18, | |
| portfolio: [ | |
| { type: 'image', url: 'https://images.unsplash.com/photo-1486406146926-c627a92ad1ab?q=80&w=600' }, | |
| { type: 'image', url: 'https://images.unsplash.com/photo-1510627489930-0c1b0baeadf3?q=80&w=600' } | |
| ] | |
| } | |
| ]; | |
| const seedDB = async () => { | |
| try { | |
| await mongoose.connect(process.env.MONGODB_URI); | |
| console.log('MongoDB connected for seeding...'); | |
| // Clear existing photographers to avoid duplicates if re-run | |
| await User.deleteMany({ role: 'photographer' }); | |
| console.log('Cleared existing photographers.'); | |
| await User.create(photographers); | |
| console.log('Seeded database with sample photographers!'); | |
| mongoose.connection.close(); | |
| } catch (err) { | |
| console.error('Seed error:', err); | |
| } | |
| }; | |
| seedDB(); | |