An Employee Management System implemented as a spring boot web application, that can run in any operating system!
Notifier is a RESTful service that exposes 14 easy use endpoints. Besides of the ordinary CRUD operation, the app has a feature of sending messages in the company, to a specific employee or to a whole team. Entities are managed by hibernate ORM, an embedded database is created by a script written in SQL, and repositories implement CRUD repositories to save boiler plate code. Maven manages all project dependencies, plugins and properties. The code follows Object Oriented practice and keeps the Spring convention of packaging. In addition, it is testable and has 56 different tests. Junit is used for testing, and Mockito framework for unit testing.
- Java 11
- Maven + JAVA_HOME set to jdk
-
Clone the repository:
$ git clone https://github.com/Itayventura/Notifier.git
-
Build and run tests:
$ mvn clean install
-
Run app :
java -jar target/notifier-0.0.1-snapshot.jar
GET localhost:8080/employees/
{
"_embedded": {
"employeeList": [
{
"employeeId": 1,
"firstName": "Itay",
"lastName": "Ventura",
"emailAddress": "a@a.com",
"roll": "software developer",
"team": {
"teamId": 1,
"name": "sw1",
"department": "R&D"
},
"_links": {
"self": {
"href": "http://localhost:8080/employees/1"
},
"employees": {
"href": "http://localhost:8080/employees"
}
}
},
{
"employeeId": 2,
"firstName": "Mani",
"lastName": "mani",
"emailAddress": "c@c.com",
"roll": "Team leader",
"team": {
"teamId": 1,
"name": "sw1",
"department": "R&D"
},
"_links": {
"self": {
"href": "http://localhost:8080/employees/2"
},
"employees": {
"href": "http://localhost:8080/employees"
}
}
},
{
"employeeId": 3,
"firstName": "Moshe",
"lastName": "Moshiko",
"emailAddress": "b@b.com",
"roll": "software developer",
"team": {
"teamId": 2,
"name": "sw2",
"department": "R&D"
},
"_links": {
"self": {
"href": "http://localhost:8080/employees/3"
},
"employees": {
"href": "http://localhost:8080/employees"
}
}
}
]
},
"_links": {
"self": {
"href": "http://localhost:8080/employees"
}
}
}
GET localhost:8080/employees/{id}
{
"employeeId": 1,
"firstName": "Itay",
"lastName": "Ventura",
"emailAddress": "a@a.com",
"roll": "software developer",
"team": {
"teamId": 1,
"name": "sw1",
"department": "R&D"
},
"_links": {
"self": {
"href": "http://localhost:8080/employees/1"
},
"employees": {
"href": "http://localhost:8080/employees"
}
}
}
POST localhost:8080/employees/new
{
"firstName": "my",
"lastName": "Employee",
"emailAddress": "new@Employee.com",
"roll": "Software Engineer",
"team":
{
"teamId": 1
}
}
{
"employeeId": 4,
"firstName": "my",
"lastName": "Employee",
"emailAddress": "new@Employee.com",
"roll": "Software Engineer",
"team": {
"teamId": 1,
"name": null,
"department": null
},
"_links": {
"self": {
"href": "http://localhost:8080/employees/4"
},
"employees": {
"href": "http://localhost:8080/employees"
}
}
}
DELETE localhost:8080/employees/delete
{
"employeeId": 4,
"firstName": "new",
"lastName": "Employee",
"emailAddress": "new@Employee.com",
"roll": "Software Engineer",
"team":
{
"teamId": 2
}
}
PUT localhost:8080/employees/update
{
"employeeId": 1,
"firstName": "new",
"lastName": "Employee",
"emailAddress": "new@Employee.com",
"roll": "Software Engineer",
"team":
{
"teamId": 2,
"name": "sw2",
"department": "R&D"
}
}
{
"employeeId": 1,
"firstName": "new",
"lastName": "Employee",
"emailAddress": "new@Employee.com",
"roll": "Software Engineer",
"team": {
"teamId": 2,
"name": "sw2",
"department": "R&D"
},
"_links": {
"self": {
"href": "http://localhost:8080/employees/1"
},
"employees": {
"href": "http://localhost:8080/employees"
}
}
}
{
"_embedded": {
"employeeList": [
{
"employeeId": 2,
"firstName": "Mani",
"lastName": "mani",
"emailAddress": "c@c.com",
"roll": "Team leader",
"team": {
"teamId": 1,
"name": "sw1",
"department": "R&D"
},
"_links": {
"self": {
"href": "http://localhost:8080/employees/2"
},
"employees": {
"href": "http://localhost:8080/employees"
}
}
}
]
},
"_links": {
"self": {
"href": "http://localhost:8080/employees/team/1"
}
}
}
GET localhost:8080/teams
{
"_embedded": {
"teamList": [
{
"teamId": 1,
"name": "sw1",
"department": "R&D",
"_links": {
"self": {
"href": "http://localhost:8080/teams/1"
},
"teams": {
"href": "http://localhost:8080/teams"
}
}
},
{
"teamId": 2,
"name": "sw2",
"department": "R&D",
"_links": {
"self": {
"href": "http://localhost:8080/teams/2"
},
"teams": {
"href": "http://localhost:8080/teams"
}
}
}
]
},
"_links": {
"self": {
"href": "http://localhost:8080/teams"
}
}
}
GET localhost:8080/teams/{id}
{
"teamId": 1,
"name": "sw1",
"department": "R&D",
"_links": {
"self": {
"href": "http://localhost:8080/teams/1"
},
"teams": {
"href": "http://localhost:8080/teams"
}
}
}
POST localhost:8080/team/new
{
"name": "my team",
"department": "R&D"
}
{
"teamId": 3,
"name": "my team",
"department": "R&D",
"_links": {
"self": {
"href": "http://localhost:8080/teams/3"
},
"teams": {
"href": "http://localhost:8080/teams"
}
}
}
GET localhost:8080/messages
[
{
"messageId": 1,
"content": "This is a first message",
"sender": {
"employeeId": 2,
"firstName": "Mani",
"lastName": "mani",
"emailAddress": "c@c.com",
"roll": "Team leader",
"team": {
"teamId": 1,
"name": "sw1",
"department": "R&D"
}
},
"localDateTime": "2021-02-02T15:40:19.12022",
"team": {
"teamId": 1,
"name": "sw1",
"department": "R&D"
},
"type": "Team"
}
]
GET localhost:8080/messages/team/{id}
{
"teamId": 1,
"name": "my team",
"department": "R&D"
}
[
{
"messageId": 1,
"content": "This is a first message",
"sender": {
"employeeId": 2,
"firstName": "Mani",
"lastName": "mani",
"emailAddress": "c@c.com",
"roll": "Team leader",
"team": {
"teamId": 1,
"name": "sw1",
"department": "R&D"
}
},
"localDateTime": "2021-02-02T15:40:19.12022",
"team": {
"teamId": 1,
"name": "sw1",
"department": "R&D"
},
"type": "Team"
}
]
GET localhost:8080/messages/employee/{id}
{
"employeeId": 2,
"firstName": "Mani",
"lastName": "mani",
"emailAddress": "c@c.com",
"roll": "Team leader",
"team": {
"teamId": 1,
"name": "sw1",
"department": "R&D"
}
}
[
{
"messageId": 1,
"content": "This is a first message",
"sender": {
"employeeId": 2,
"firstName": "Mani",
"lastName": "mani",
"emailAddress": "c@c.com",
"roll": "Team leader",
"team": {
"teamId": 1,
"name": "sw1",
"department": "R&D"
}
},
"localDateTime": "2021-02-02T15:40:19.12022",
"team": {
"teamId": 1,
"name": "sw1",
"department": "R&D"
},
"type": "Team"
}
]
POST localhost:8080/messages/employee/new
{
"content": "this is a new content of employee message",
"sender": {
"employeeId": 1
},
"employee": {
"employeeId": 2
}
}
{
"messageId": 1,
"content": "this is a new content of employee message",
"sender": {
"employeeId": 1,
"firstName": null,
"lastName": null,
"emailAddress": null,
"roll": null,
"team": null
},
"localDateTime": "2021-02-02T16:10:08.3215814",
"employee": {
"employeeId": 2,
"firstName": null,
"lastName": null,
"emailAddress": null,
"roll": null,
"team": null
},
"type": "Employee"
}
POST localhost:8080/messages/team/new
{
"content": "this is a new content",
"sender": {
"employeeId": 1
},
"team": {
"teamId": 1
}
}
{
"messageId": 2,
"content": "this is a new content",
"sender": {
"employeeId": 1,
"firstName": null,
"lastName": null,
"emailAddress": null,
"roll": null,
"team": null
},
"localDateTime": "2021-02-02T16:12:37.9457285",
"team": {
"teamId": 1,
"name": null,
"department": null
},
"type": "Team"
}