- This project is an API, it must to be possible to calculate a vacation of a Employee's by your
startDate
andbaseSalary
at 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:
name
andpassword
. -
name
type: string. -
password
type: string. -
BaseURL example:
http://localhost:8080/createBoss
-
This route must recieve at the body of the http request the follow parameters:
name
andpassword
, and must recieve through header of http request, by (query params) the parameterboss_id
. -
name
type: string. -
password
type: string. -
boss_id
type: 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_id
type: 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_id
type: 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
,baseSalary
andstartDate
, 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. -
employeeName
type: string. -
jobTitle
type: string. -
baseSalary
type: number (int or float) -
startDate
type: string .... for this parameter the follow format must be passed .. example:04/02/2024
, which means04
month,02
day and2024
year, based on date US standardmm/dd/yyyy
-
boss_id
type: 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_id
type: 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_id
type: 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_id
type: 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_id
type: 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_id
type: 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 install
oryarn install
, depends on the installed package manager. - You will need to create a
.env
file onroot
of this application, and copy the environment variables that is in.env.example
of this application. IMPORTANT
: uncomment this line (POSTGRES_HOST_LOCAL=localhost) in your.env
file 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.js
for do it, run the folow comandnpm create:tables
oryarn create:tables
in your terminal. - After do the steps above, you can run
npm dev
oryarn 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 install
oryarn install
, depends on the installed package manager. -
You will need to create a
.env
file onroot
of this application, and copy the environment variables that is in.env.example
of this application. -
IMPORTANT
: keep this line commented (# POSTGRES_HOST_LOCAL=localhost) in your.env
file 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 up
in the terminal to create the containers for this application, or when you start these containers with the samedocker compose up
command, 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