Short description of the application and why I am having the problem
I am making a website with express/Apollo API server. I want to isolate the use-cases and the resolver for the Apollo server.
So I made three classes, one class named createTender in the entity folder, a second class, the handler, which formats the data so the createTender only gets the data it needs. The third class is the dataBaseGatway the middle man for the application and the database.
I did not include the dataBase or the mongoose module in the diagram.
Here is the scenario for the question
In one instance, I need to create a table in the database, and I need to await the function that will create that table. But the function that i call from the resolver(where the API request is handled) calls another function that handles the creation of the table, then saves it to MongoDB and checks for errors. This function is async/await, it awaits for the new table to be saved.
Here is the question
Are nested promises a good practice?
Is there something wrong with creating promise that has promise inside it?
And what about a promise inside a promise inside a promise?