This is the backend of the Employee Management App, a platform for managing employee information, roles, and authentication. The backend is built using Spring Boot and H2 Database.
- Add, update, fetch, and delete employee records
- Role-based authentication and authorization
- Password encryption and secure handling of user data
- API endpoints for managing employees
- ApiResponse: For all general success and failure responses.
- ApiErrorResponse: For structured error messages when something goes wrong (e.g., 404 Not Found, 500 Internal Server Error).
- ErrorDetails: Specifically for detailed field-level validation errors.
- Spring Boot: Framework for building the backend
- H2 Database: In-memory database for development and testing
- Spring Security: For authentication and authorization
- Maven: For dependency management and building the project
- Lombok: For reducing boilerplate code (Lombok is not working in my IDE, debugging in progress)
-
Clone this repository to your local machine:
git clone https://github.com/mihirrz/Employee-Management-App-Backend.git
-
Navigate to the project directory:
cd Employee-Management-App-Backend
-
Build the project using Maven:
mvn clean install
-
Run the application:
mvn spring-boot:run
- URL:
POST /api/employee/createNewEmployee
- Request Body:
{ "employeeFirstName": "Mihir", "employeeLastName": "Raj", "employeeContactNumber": "1234567890", "employeeEmail": "mihirraj@52gmail.com", "employeeRole": "ADMIN", "employeeDesignation": "Developer", "password": "admin123" }
- URL:
GET /api/employee/employeesList
- URL:
PUT /api/employee/updateEmployee/{id}
- Request Body:
{ "employeeFirstName": "UpdatedFirstName", "employeeLastName": "UpdatedLastName", "employeeContactNumber": "9876543210", "employeeEmail": "updatedemail@example.com", "employeeRole": "USER", "employeeDesignation": "Tester", "password": "newpassword" }
- URL:
DELETE /api/employee/deleteEmployee/{id}
You can test the API endpoints using POSTMAN with Basic Authentication. The authentication credentials are specified in the application.yaml
file as follows:
admin:
username: admin
password: admin123
user:
username: user
password: user123
- Open POSTMAN and create a new request.
- For each API endpoint, set the Authorization type to Basic Auth.
- Enter the following credentials:
- Username:
admin
- Password:
admin123
- Username:
- Test the endpoints by providing the required input and headers as described in the API section.
Feel free to fork this repository and submit pull requests for any enhancements or bug fixes. For major changes, please open an issue first to discuss what you would like to change.
Developed by Mihir Raj. For any queries or support, reach out at mihirraj52@gmail.com.