- This project is an API, it must to be possible to calculate a vacation of a Employee's by your
startDateandbaseSalaryat the company, so .. for this, need to create aBoss, and this boss need to authenticate with atoken, for do all the functionalitis of this API, the functionalities are:
- Module
Boss: (create a Boss, create Token, search a Boss and delete a Boss);
- Module
Employee: (create a Employee, search a Employee and delete a Employee); - Module
Vacation: (Calculate a Vacation, search a Vacation and delete a Vacation);
- Nodejs in version v20.15.0 (LTS)
- Postgres
- Express
- JsonWebToken
- Docker
- Jest
- Swagger
- Github Actions
http://localhost:8080
- See here in this link: Word Document prints and explanations of how you can configure all the routes below.
-
This route must recieve at the body of the http request the follow parameters:
nameandpassword. -
nametype: string. -
passwordtype: string. -
BaseURL example:
http://localhost:8080/createBoss
-
This route must recieve at the body of the http request the follow parameters:
nameandpassword, and must recieve through header of http request, by (query params) the parameterboss_id. -
nametype: string. -
passwordtype: string. -
boss_idtype: string UUID. -
BaseURL example:
http://localhost:8080/createToken?boss_id=6ff0bbf3-248b-4ef1-9877-bf747b1ee715
-
This route must recieve through header of http request, by (query params) the parameter
boss_id. -
boss_idtype: string UUID. -
BaseURL example:
http://localhost:8080/searchBoss?boss_id=e62850f1-e4cf-46e2-90e0-41b8c069c3ff
-
This route must recieve through header of http request, by (query params) the parameter
boss_id. -
boss_idtype: string UUID. -
BaseURL example:
http://localhost:8080/deleteBoss?boss_id=e62850f1-e4cf-46e2-90e0-41b8c069c3ff
-
This route must recieve at the body of the http request the follow parameters:
employeeName,jobTitle,baseSalaryandstartDate, and must recieve through header of http request, by (query params) the parameterboss_id, and also must recieve by (Bearer param) thetoken, so that it's possible to complete the end-point request. -
employeeNametype: string. -
jobTitletype: string. -
baseSalarytype: number (int or float) -
startDatetype: string .... for this parameter the follow format must be passed .. example:04/02/2024, which means04month,02day and2024year, based on date US standardmm/dd/yyyy -
boss_idtype: string UUID. -
BaseURL example:
http://localhost:8080/createEmployee?boss_id=0849d791-731d-4a93-9a42-c2e68cfb4e40
-
This route must recieve through header of http request, by (query params) the parameter
employee_id, and also must recieve by (Bearer param) thetoken, so that it's possible to complete the end-point request. -
employee_idtype: string UUID. -
BaseURL example:
http://localhost:8080/searchEmployee?employee_id=b31833eb-c081-4400-bf9f-c12ce6e9e01a
-
This route must recieve through header of http request, by (query params) the parameter
employee_id, and also must recieve by (Bearer param) thetoken, so that it's possible to complete the end-point request. -
employee_idtype: string UUID. -
BaseURL example:
http://localhost:8080/deleteEmployee?employee_id=5115044b-2486-4a8e-8720-1ccc52b8522a
-
This route must recieve through header of http request, by (query params) the parameter
employee_id, and also must recieve by (Bearer param) thetoken, so that it's possible to complete the end-point request. -
employee_idtype: string UUID. -
BaseURL example:
http://localhost:8080/calculateVacation?employee_id=7976abab-9358-42ba-b017-32019b6c6024
-
This route must recieve through header of http request, by (query params) the parameter
vacation_id, and also must recieve by (Bearer param) thetoken, so that it's possible to complete the end-point request. -
vacation_idtype: string UUID -
BaseURL example:
http://localhost:8080/searchVacation?vacation_id=5994f067-764f-4c98-8018-74c4329cbaf7
-
This route must recieve through header of http request, by (query params) the parameter
vacation_id, and also must recieve by (Bearer param) thetoken, so that it's possible to complete the end-point request. -
vacation_idtype: string UUID -
BaseURL example:
http://localhost:8080/deleteVacation?vacation_id=55e29f5a-1dd2-4770-af21-0cf507a02a24
- Copy the url of this repo in tab
< > CODE, and running in terminal ....git clone "link...." - Go to project folder ....
cd Solvd-Employee-Leave-Management - Install dependencies ....
npm installoryarn install, depends on the installed package manager. - You will need to create a
.envfile onrootof this application, and copy the environment variables that is in.env.exampleof this application. IMPORTANT: uncomment this line (POSTGRES_HOST_LOCAL=localhost) in your.envfile created in the previous step.- You will need to create a database with any name that you want, and run the scripts for create the tables that is in a file
createTables.jsfor do it, run the folow comandnpm create:tablesoryarn create:tablesin your terminal. - After do the steps above, you can run
npm devoryarn dev, in your ternminal for run this application.
-
For running application in Docker container you should have docker installed on your system.
-
Copy the url of this repo in tab
< > CODE, and running in terminal ....git clone "link...." -
Go to project folder ....
cd Solvd-Employee-Leave-Management -
Install dependencies ....
npm installoryarn install, depends on the installed package manager. -
You will need to create a
.envfile onrootof this application, and copy the environment variables that is in.env.exampleof this application. -
IMPORTANT: keep this line commented (# POSTGRES_HOST_LOCAL=localhost) in your.envfile created in the previous step. -
Tables in the docker container database are created automatically.
-
After following check the steps above, you can running the application with the follow comand
docker compose up. -
For stop you can use the follow comand
docker compose down.
- After following the steps
How to running this application in docker container. - Whenever you type
docker compose upin the terminal to create the containers for this application, or when you start these containers with the samedocker compose upcommand, docker will automatically run all the integration tests for this application, and you can see the results in the terminal. - After the above step, the container created to run the tests will be stopped automatically, and you will be able to test this application manually, if you wish.
- After following the steps
How to running this application Localy. - Type on terminal
npm run test, oryarn test, deppends on your package manager installed.
- Go to your web brownser and type the follow url ....
http://localhost:8080/api-doc


