employee-management-system is a Loopback.js 4 project with TypeScript and PostgreSQL. It can be used to manage a company's employees, departments, office locations etc.
-
This project utilizes Docker and
docker-compose
.-
Install Docker.
-
Install
docker-compose
.
-
pip3 install docker-compose
- Run the project with the following command. Database tables and initial data will be automatically created.
docker-compose up --build
Execute following command to run the tests:
docker exec employee-management-system_app_1 npm run test
Noteworthy endpoints are listed below, along with examples. If you want to see the entire set of endpoints check /explorer
.
Connects to BigDataCloud Reverse Geocoding API and retrieves address information from (latitude
, longitude
) pair
/address?latitude=48.1351&longitude=11.5820
{
"city": "Munich",
"country": "Germany",
"postcode": "80331",
"address": "Bavaria"
}
Calculates average salary of employees in a specified department with id id
.
/departments/1/averageSalary
Department 1 has got three employees with salaries 20000, 10000 and 11000. Average salary gets calculated by SalaryService
.
13075
Retrieves title changes (most recent first) of an employee with id id
.
/employees/3/history
{
"id": 3,
"name": "Annie",
"surname": "Carter",
"email": "cartera@gmail.com",
"phone": "05091112233",
"startdate": "2020-09-02T16:45:56.615Z",
"salary": 10000,
"title": "Software Engineer",
"managerId": 1,
"departmentId": 1,
"titleChanges": [
{
"id": 3,
"startdate": "2019-09-06T14:06:51.596Z",
"enddate": null,
"title": "Software Engineer",
"departmentId": 1,
"employeeId": 3
},
{
"id": 1,
"startdate": "2018-09-06T14:06:51.596Z",
"enddate": "2019-09-06T14:06:51.596Z",
"title": "Specialist",
"departmentId": 1,
"employeeId": 3
}
]
}
Retrieves list of employees with title 'Manager'
associated with the employees reporting to them.
/hierarchy
[
{
"Adam": [
{
"name": "Annie"
},
{
"name": "Grace"
},
{
"name": "Sabre"
}
]
},
{
"Ahmet": []
},
{
"Julian": [
{
"name": "Farrah"
}
]
}
]
Retrieves detailed list of employees with title 'Manager'
.
/managers
[
{
"id": 1,
"name": "Adam",
"surname": "Smith",
"email": "adam@gmail.com",
"phone": "05321234567",
"startdate": "2020-09-04T16:45:56.615Z",
"salary": 20000,
"title": "Manager",
"managerId": 0,
"departmentId": 1
},
{
"id": 2,
"name": "Ahmet",
"surname": "Kaptan",
"email": "akaptan@gmail.com",
"phone": "05077654321",
"startdate": "2020-09-02T16:45:56.615Z",
"salary": 21000,
"title": "Manager",
"managerId": 0,
"departmentId": 2
},
{
"id": 7,
"name": "Julian",
"surname": "Bream",
"email": "jbrip@gmail.com",
"phone": "05009876543",
"startdate": "2020-09-02T16:45:56.615Z",
"salary": 18900,
"title": "Manager",
"managerId": 0,
"departmentId": 3
}
]
- Put all config variables into environment variables
- Create different environments for prod, dev and test
- Complete unit tests
- Improve schema relations
- Add authentication and authorization
- Add a logger