Closed AhmedQeshta closed 2 years ago
await Promise.all([ ...users.map(async (user: any) => { await User.create(user); }), ...gyms.map(async (gym: any) => { await Gym.create(gym); }), ]);
await Promise.all([ ...images.map(async (image: any) => { await Image.create(image); }), ...subscription.map(async (sub: any) => { await Subscription.create(sub); }), ...reviews.map(async (review: any) => { await Review.create(review); }), ]);
And remove subscriptions and reviews and images to another Promise.all block, to make sure to create them after creating users and gyms
Promise.all
Fix build database function to create data async
And remove subscriptions and reviews and images to another
Promise.all
block, to make sure to create them after creating users and gyms