/staff-scheduling-system

The staff scheduling application allows users to create an account and log in to the system. The application supports two user roles: Staff User and Admin. Staff Users can view their own schedule for any period of time up to one year, and they can see the schedules of their coworkers. Admins, on the other hand, have more powerful permissions.

Primary LanguageTypeScriptGNU General Public License v3.0GPL-3.0

Staff-scheduling-system v1.0.0

Image

This code should be reviewed listening the Rainbow 😎🀘🎢🎡

Since You've Been Gone

Project Description:

The staff scheduling application allows users to create an account and log in to the system. The application supports two user roles: Staff User and Admin. Staff Users can view their own schedule for any period of time up to one year, and they can see the schedules of their coworkers. Admins, on the other hand, have more powerful permissions. They can edit and delete all users, create, edit, and delete schedules for users, and order the users list by accumulated work hours per arbitrary period up to one year.

Schedules in the application contain the work date, the user assigned to the schedule, and the shift length in hours. The application provides relevant REST endpoints that can be accessed and interacted with via Postman or other similar software. It also includes relevant unit tests and a documentation page using Open API specifications. Finally, the application is dockerized and includes a README file describing how to run the project.

Installation instructions:

Check at the code documentation here to see the whole setup:

Link to code documentation

To install all packages in this project.

npm install

To run development serverπŸ”“πŸ”“πŸ”“πŸ› πŸ› 

First run:

npm run build

and then:

npm run start:dev 

To run production πŸ‘©β€πŸš€πŸ‘©β€πŸš€πŸ‘©β€πŸš€πŸš€:

npm start:prod

To run test πŸ“•πŸ“–πŸ”πŸ”:

npm run test

You migth have to configurate dotenv this way couse sometimes the library doenst work properly couse sometimes the library doenst work properly.

dotenv.config({ path: 'C:/your/path/staff-scheduling-system/.env' }); 

Configure your dotenv credentials and route paths.

  • This app implements a .env file that store all the database credentials and environment variables and also, you need to import dotenv to the database connection, the index.ts file and the JWT file.

How to setup docker for this app:

First, setup inside the .env file the global variable:

Change from :

DB_HOST=localhost

to

DB_HOST=host.docker.internal 

This is because its necesary for docker to emulate your database address as if its not local.

To build the docker image:

docker build --no-cache -t node-backend .

To build the container:

docker run --add-host host.docker.internal:host-gateway -p 8080 -d node-backend 

This will expose the port from our localserver