Package com.myhrcrmproject.controller
Class EmployeeController
java.lang.Object
com.myhrcrmproject.controller.EmployeeController
Controller class for managing employee-related operations in the HR CRM system.
This class provides RESTful endpoints for retrieving, creating, updating,
and deleting employee records. It interacts with the EmployeeService
for handling business logic and data access.
Additionally, it includes endpoints for finding employees by their ID, retrieving a list of all employees, creating a new employee (with administrator role required), updating an existing employee, and deleting an employee (with manager role required).
The class is annotated with @RestController to indicate its role
as a Spring REST controller and is mapped to the "/api/employees" endpoint.
- Version:
- 1.0
- Author:
- Denys Chaykovskyy
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<EmployeeResponseDTO>createNew(EmployeeRequestDTO requestDTO) Endpoint to create a new communication.voidEndpoint to delete a communication.org.springframework.http.ResponseEntity<List<EmployeeResponseDTO>>findAll()Endpoint to retrieve a list of all communications.org.springframework.http.ResponseEntity<EmployeeResponseDTO>Endpoint to retrieve a communication by its ID.org.springframework.http.ResponseEntity<EmployeeResponseDTO>update(Integer id, EmployeeRequestDTO requestDTO) Endpoint to update an existing communication.
-
Constructor Details
-
EmployeeController
public EmployeeController()
-
-
Method Details
-
findAll
Endpoint to retrieve a list of all communications.- Returns:
- A
ResponseEntitywith a list ofCommunicationResponseDTOrepresenting all communications.
-
findById
@GetMapping("/{id}") public org.springframework.http.ResponseEntity<EmployeeResponseDTO> findById(@PathVariable("id") Integer id) Endpoint to retrieve a communication by its ID.- Parameters:
id- The ID of the communication to retrieve.- Returns:
- A
ResponseEntitywith theCommunicationResponseDTOrepresenting the retrieved communication.
-
createNew
@PostMapping public org.springframework.http.ResponseEntity<EmployeeResponseDTO> createNew(@RequestBody EmployeeRequestDTO requestDTO) Endpoint to create a new communication.- Parameters:
requestDTO- The request body containing communication details.- Returns:
- A
ResponseEntitywith theCommunicationResponseDTOrepresenting the newly created communication.
-
update
@PutMapping("/{id}") public org.springframework.http.ResponseEntity<EmployeeResponseDTO> update(@PathVariable("id") Integer id, @RequestBody EmployeeRequestDTO requestDTO) Endpoint to update an existing communication.- Parameters:
id- The ID of the communication to update.requestDTO- The request body containing updated communication details.- Returns:
- A
ResponseEntitywith theCommunicationResponseDTOrepresenting the updated communication.
-
delete
@DeleteMapping("/{id}") @ResponseStatus(NO_CONTENT) public void delete(@PathVariable("id") Integer id) Endpoint to delete a communication. Requires manager role.- Parameters:
id- The ID of the communication to delete.
-