A simple CLI tool utilizing mySQL to store and keep track of employee records and info.
-
Clone the repository to your local machine.
git clone <repository_url> cd <project_directory>
-
Install the project's dependencies by running:
npm install
-
Make sure you have mySQL installed on your machine, login to mySQL CLI, and create the database
mysql -u 'username' -p
source db/schema.sql source db/seeds.sql
This is a simple CLI tool that will allow you to store your employee's information in a mySQL database, and allow you to view and edit that information.
-
Run the program with node using
node index.js
-
Follow the onscreen prompts to view and manipulate the data as you see fit :)
I decided to use the latest version of Inquirer which is an ES6 module, so this program uses the ES6 syntax to import the dependencies. This allows me to use inquirer prompts as async/await functions and really helps clean up the code. It is also what allowed me to easily create nested "list" prompts that use choices based off the mySQL queries, and create custom titles for the table columns. The inquirer documentation was great and overall it was a simple implementation that I think improves the readability quite a bit.
There are a few things I would change/add to this project.
-
I would have implemented an "isManager" boolean on the employees, which would make getting the managers to list super easy and not dependant on having a manager_id or not.
-
I would then add a prompt to change an employee to a manager, this would improve the tool if the user needed to delete or change the actual managers of the company. As of right now, we rely on assuming the user knows the schema of our database.
-
I did however decide to add AUTO INCREMENT to the ids of each table, as this just made grabbing and making new IDs super easy. If this an actual tool in production I would add UUIDs. Simple to implement but would have muddied up the code a bit so I decided against it. Using sequelize would make this trivial.
I didn't implement these changes because we were given the schema to use and I did not want to change more than I did, but those were my ideas!
N/A
This project is licensed under the terms of the MIT License.
You can find the full license text in the LICENSE file.
Thank you for checking out the project!
If you have any questions or need further assistance with this project, feel free to reach out. You can contact me through the following methods:
- GitHub Issues: Please use the Github Issue Tracker for bug reports, feature requests, or general questions related to the project. You can find my Github profile @nephh