This application was developed as an entrance exam for the company Sofex. The purpose of this project is to manage the company's employee registration only from the backend. For this, a REST system was developed in which the following requests can be made:
- Employee CRUD
- Week CRUD
- Day CRUD
- Week Start and Restart
- Check In
- Check Out
- Employee Payment Calculations
- Clone this repository
git clone https://github.com/Adrian-Garcia/ExamenIngresoBackendSofex.git
- Install dependencies
npm i
- Start application
nodemon start
- Start Database
docker-compose up -d postgres
-
Setup environment variables in .env file
-
Start localhost database (http://localhost:5050/)
docker-compose up -d pgadmin
-
Go to local and configure a new database. Documentation here
-
Test API in http://localhost:3000/api/v1/
{
"id": "abcd1234",
"firstName": "Luke",
"lastName": "Skywalker",
"positionName": "Programer",
"hourlyWage": 200
}
{
"firstName": "Luke",
"lastName": "Skywalker",
"positionName": "Programer",
"hourlyWage": 200
}
- Check In Employee http://localhost:3000/api/v1/employees/check_in
{
"time": "2023-01-02T00:00:00.000Z"
}
- Check Out Employee http://localhost:3000/api/v1/employees/check_out
{
"time": "2023-01-02T00:00:00.000Z"
}
- Get One Employee http://localhost:3000/api/v1/employees/abcd1234
- Get All Employees http://localhost:3000/api/v1/employees/
- Delete One Employee http://localhost:3000/api/v1/employees/abcd1234
- Get Payments of all employees http://localhost:3000/api/v1/employees/payment_employees/
- Get Payment of one employee http://localhost:3000/api/v1/employees/payment_employees/abcd1234
- Check In http://localhost:3000/api/v1/employees/check_in/abcd1234
- Check Out http://localhost:3000/api/v1/employees/check_out/abcd1234
{
"startWeek": "2023-01-02T00:00:00.000Z",
"endWeek": "2023-01-06T00:00:00.000Z",
"finalWeekPayment": 10000,
"employeeId": "abcd1234"
}
{
"startWeek": "2023-01-02T00:00:00.000Z",
"endWeek": "2023-01-06T00:00:00.000Z",
"finalWeekPayment": 10000,
"employeeId": "abcd1234"
}
- Get One Week http://localhost:3000/api/v1/week/1
- Get All Weeks http://localhost:3000/api/v1/weeks/
- Delete One Week http://localhost:3000/api/v1/weeks/1
- Revert all weeks http://localhost:3000/api/v1/weeks/new_week
- Revert one week http://localhost:3000/api/v1/weeks/new_week/1
{
"arrivalTime": "2023-01-02T00:00:00.000Z",
"departureTime": "2023-01-06T00:10:00.000Z",
"weekId": 1
}
{
"arrivalTime": "2023-01-02T00:00:00.000Z",
"departureTime": "2023-01-02T10:00:00.000Z",
"weekId": 1
}
- Get One Day http://localhost:3000/api/v1/day/1
- Get All Days http://localhost:3000/api/v1/day/
- Delete One Day http://localhost:3000/api/v1/day/1