GSG-G11 / Fitness-house

a website that give the user the ability to search about Gyms suits him
https://fit-house.herokuapp.com/
4 stars 4 forks source link

[Back Database] Fix build databse function to create data async #69

Closed LinaYahya closed 2 years ago

LinaYahya commented 2 years ago

fix Promise.all create to run async https://github.com/GSG-G11/Fitness-house/blob/a343b78ffc071c2118fd3494de773c5c4684cf9d/server/database/fakeData/index.ts#L21-L24

await Promise.all([ 
   ...users.map(async(user: any) => await User.create(user)), 
   ...gyms.map(async(gym: any) => await Gym.create(gym)), 
   ])

And remove subscriptions and reviews and images to another Promise.all block, to make sure to create them after creating users and gyms