Conversation
| ## Usage | ||
|
|
||
| To use the application follow the steps below: | ||
|
|
There was a problem hiding this comment.
Since this application requires any user to connect to the database, it would be good to include a step to tell them where to find the script to create the database and how to run this.
| if (!departments.length) { | ||
| console.log("Please add a Department first!!"); | ||
|
|
||
| return start(); |
There was a problem hiding this comment.
Since we're in the while loop still, you don't need to return this function and call it again, we can just return and it will start the loop again.
| if (!roles.length) { | ||
| console.log("Please add a Role first!!"); | ||
|
|
||
| return start(); |
There was a problem hiding this comment.
Please remove all of these return start() statements as they are unnecessary and cause extra code to rerun when it's not needed.
| ); | ||
|
|
||
| //construct mysql view query ordered by manager | ||
| const query = await db.query(`SELECT |
There was a problem hiding this comment.
You could perhaps store these query strings in a utils file and import them to clean this file up a bit.
| db.query(query); | ||
| } | ||
|
|
||
| if (chosenAction === "viewAllDepartments") { |
There was a problem hiding this comment.
For these three view actions, consider what happens when there is no data. Currently an empty table is generated. We should check this and handle it here with a console.log that tells the user there is no data to view.
No description provided.