Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/fredm23579/sql-employee-tracker

This is a Node.js project with a MySQL database, consisting of a RESTful API for managing departments, employees, and roles in a company.
https://github.com/fredm23579/sql-employee-tracker

Last synced: about 2 months ago
JSON representation

This is a Node.js project with a MySQL database, consisting of a RESTful API for managing departments, employees, and roles in a company.

Awesome Lists containing this project

README

        


SQL EMPLOYEE TRACKER


Codebase for the SQL EMPLOYEE TRACKER platform


◦ Developed with the software and tools below.


Node.js\
spacerMySQL\
spacerInquirer.js\
spacerExpress.js\
spacerdotenv\
spacerfiglet"
spacer




---
## 📚 Table of Contents
- [📚 Table of Contents](#-table-of-contents)
- [🔍 Description](#-description)
- [🌟 Features](#-features)
- [📁 Repository Structure](#-repository-structure)
- [💻 Demo Video](#-demo-video)
- [💻 Code Summary](#-code-summary)
- [🚀 Getting Started](#-getting-started)

---


## 🔍 Description

This is a Node.js project with a MySQL database, consisting of a RESTful API for managing departments, employees, and roles in a company. The project includes a `db` directory with schema and seed files, as well as a `lib` directory with utility functions for connecting to the database and performing queries. The `models` directory contains JavaScript classes for each of the three entities, and the `index.js` file is the entry point for the application.

---

## 🌟 Features

Node.js, MySQL, RESTful API, departments, employees, roles, company, schema, seed, utility functions, connection, queries, models, JavaScript classes

---

## 📁 Repository Structure

```sh
├── .env
├── .gitignore
├── db
│ ├── schema.sql
│ └── seeds.sql
├── index.js
├── lib
│ ├── connection.js
│ ├── queries.js
│ └── utils.js
├── LICENSE
├── models
│ ├── department.js
│ ├── employee.js
│ └── role.js
├── package-lock.json
├── package.json
└── README.md

```
---

## Demo Video

- [demo video](https://drive.google.com/file/d/1kzjCWhborksz4Yp_1Lof7safywFpYE9N/view?usp=sharing)

---

## 💻 Code Summary

Root

| File | Summary |
| ---- | ------- |
| index.js | The code is a command-line application that allows users to interact with a database of employees, departments, and roles. It provides a menu-driven interface for viewing, adding, updating, and deleting data, as well as exiting the application. |

---

\lib

| File | Summary |
| ---- | ------- |
| connection.js | The code creates a connection pool for a MySQL database using the `mysql2` package, loads environment variables from a `.env` file, and exports the pool as a promise. |
| queries.js | The code defines a set of functions for interacting with a database, including retrieving data, adding new records, and updating existing ones. |
| utils.js | The code defines two functions, `promptUser` and `promptInput`, which use the `inquirer` package to prompt the user with a list of choices or for input, respectively. |

---

\models

| File | Summary |
| ---- | ------- |
| department.js | The code defines a module that exports functions to interact with a database using the `pool` connection from the `../lib/connection` file. |
| employee.js | The code defines a module that exports functions to interact with a database using the `pool` connection. |
| role.js | The code defines a module that exports functions to interact with a database using the `pool` connection from the `../lib/connection` file. |

---

## 🚀 Getting Started

To get started with this project, follow these steps:

1. Install the necessary dependencies by running `npm install` in your terminal.
2. Create a `.env` file in the root directory of the project and add your MySQL username and password to it, like this:
```
DB_USER=your_username
DB_PASSWORD=your_password
```
3. Start the application by running `node index.js` in your terminal.
4. Use the command-line interface to interact with the application and manage the employee database.

Note: Before you start, make sure you have a MySQL server running on your local machine and that you have created the necessary database and tables using the schema and seed files in the `db` directory.