Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Employee Management

Developed using Java Spring framework, this is a collection of endpoints that can be used to run CRUD operations on Employee table

Employee Schema

id (UUID or autogenerated) 
firstName
lastName
email
department
salary

Pre-requisites

  • Java version 17
  • Maven

Clone repository

git clone git@github.com:itisprasad/employeemanagement.git

Run the application

cd employeemanagement
mvn spring-boot:run

Test Endpoints

Create Employee

curl -X POST http://localhost:8080/api/employees      -H "Content-Type: application/json"      -d '{
           "firstName": "John",
           "lastName": "Doe",
           "email": "john.doe@example.com",
           "department": "IT",
           "salary": 60000
         }'

Output

{"id":"a9fcd855-23b1-4862-b8f4-e36c195e7df4","firstName":"John","lastName":"Doe","email":"john.doe@example.com","department":"IT","salary":60000.0}

List Employees

curl -X GET "http://localhost:8080/api/employees"

Output

[{"id":"a9fcd855-23b1-4862-b8f4-e36c195e7df4","firstName":"John","lastName":"Doe","email":"john.doe@example.com","department":"IT","salary":60000.0},{"id":"7805ccaa-485e-4744-8766-d0c2f34ec29f","firstName":"John","lastName":"Doe","email":"john.doe1@example.com","department":"IT","salary":60000.0}]

Search for an Employee

curl -X GET "http://localhost:8080/api/employees/a9fcd855-23b1-4862-b8f4-e36c195e7df4"

Output

{"id":"a9fcd855-23b1-4862-b8f4-e36c195e7df4","firstName":"John","lastName":"Doe","email":"john.doe@example.com","department":"IT","salary":60000.0}

Update Employee

curl -X PUT http://localhost:8080/api/employees/a9fcd855-23b1-4862-b8f4-e36c195e7df4      -H "Content-Type: application
/json"      -d '{
           "firstName": "Jane",
           "lastName": "Doe",
           "email": "jane.doe0@example.com",
           "department": "HR",
           "salary": 75000
         }'

Output

{"id":"a9fcd855-23b1-4862-b8f4-e36c195e7df4","firstName":"Jane","lastName":"Doe","email":"jane.doe0@example.com","department":"HR","salary":75000.0}

Delete Employee

curl -X DELETE "http://localhost:8080/api/employees/{ID}"

To run Tests

mvn test

Output

[INFO] Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 15.56 s -- in com.employee.controller.EmployeeControllerTest
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 5, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  27.453 s
[INFO] Finished at: 2025-02-04T23:06:49+07:00
[INFO] ------------------------------------------------------------------------

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages