Package com.myhrcrmproject.controller
Class CommunicationController
java.lang.Object
com.myhrcrmproject.controller.CommunicationController
@RestController
@RequestMapping("api/communications")
public class CommunicationController
extends Object
Controller class for managing communication-related operations in the HR CRM system.
This class provides RESTful endpoints for retrieving, creating, updating,
and deleting communication records. It interacts with the CommunicationService
for handling business logic and data access.
Additionally, it includes endpoints for finding communications by their ID, retrieving a list of all communications, creating a new communication, updating an existing communication, and deleting a communication. There are also endpoints for finding communications by type ID, employee ID, client ID, candidate ID, and vacancy ID.
The class is annotated with @RestController to indicate its role
as a Spring REST controller and is mapped to the "/api/communications" endpoint.
- Version:
- 1.0
- Author:
- Denys Chaykovskyy
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<CommunicationResponseDTO>createNew(CommunicationRequestDTO requestDTO) Endpoint to create a new communication.voidEndpoint to delete a communication.org.springframework.http.ResponseEntity<List<CommunicationResponseDTO>>findAll()Endpoint to retrieve a list of all communications.org.springframework.http.ResponseEntity<List<CommunicationResponseDTO>>Endpoint to retrieve a list of communications by candidate ID.org.springframework.http.ResponseEntity<List<CommunicationResponseDTO>>Endpoint to retrieve a list of communications by client ID.org.springframework.http.ResponseEntity<List<CommunicationResponseDTO>>Endpoint to retrieve a list of communications by type ID.org.springframework.http.ResponseEntity<List<CommunicationResponseDTO>>Endpoint to retrieve a list of communications by employee ID.org.springframework.http.ResponseEntity<List<CommunicationResponseDTO>>Endpoint to retrieve a list of communications by vacancy ID.org.springframework.http.ResponseEntity<CommunicationResponseDTO>Endpoint to retrieve a communication by its ID.org.springframework.http.ResponseEntity<CommunicationResponseDTO>update(Integer id, CommunicationRequestDTO requestDTO) Endpoint to update an existing communication.
-
Constructor Details
-
CommunicationController
public CommunicationController()
-
-
Method Details
-
findAll
@GetMapping public org.springframework.http.ResponseEntity<List<CommunicationResponseDTO>> 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<CommunicationResponseDTO> 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<CommunicationResponseDTO> createNew(@RequestBody CommunicationRequestDTO 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<CommunicationResponseDTO> update(@PathVariable("id") Integer id, @RequestBody CommunicationRequestDTO 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.- Parameters:
id- The ID of the communication to delete.
-
findAllByCommunicationTypeId
@GetMapping("/findAllByCommunicationTypeId/{id}") public org.springframework.http.ResponseEntity<List<CommunicationResponseDTO>> findAllByCommunicationTypeId(@PathVariable("id") Integer id) Endpoint to retrieve a list of communications by type ID.- Parameters:
id- The ID of the type.- Returns:
- A
ResponseEntitywith a list ofCommunicationResponseDTOrepresenting communications by type ID.
-
findAllByEmployeeId
@GetMapping("/findAllByEmployee/{id}") public org.springframework.http.ResponseEntity<List<CommunicationResponseDTO>> findAllByEmployeeId(@PathVariable("id") Integer id) Endpoint to retrieve a list of communications by employee ID.- Parameters:
id- The ID of the employee.- Returns:
- A
ResponseEntitywith a list ofCommunicationResponseDTOrepresenting communications by employee ID.
-
findAllByClientId
@GetMapping("/findAllByClient/{id}") public org.springframework.http.ResponseEntity<List<CommunicationResponseDTO>> findAllByClientId(@PathVariable("id") Integer id) Endpoint to retrieve a list of communications by client ID.- Parameters:
id- The ID of the client.- Returns:
- A
ResponseEntitywith a list ofCommunicationResponseDTOrepresenting communications by client ID.
-
findAllByCandidateId
@GetMapping("/findAllByCandidate/{id}") public org.springframework.http.ResponseEntity<List<CommunicationResponseDTO>> findAllByCandidateId(@PathVariable("id") Integer id) Endpoint to retrieve a list of communications by candidate ID.- Parameters:
id- The ID of the candidate.- Returns:
- A
ResponseEntitywith a list ofCommunicationResponseDTOrepresenting communications by candidate ID.
-
findAllByVacancyId
@GetMapping("/findAllByVacancy/{id}") public org.springframework.http.ResponseEntity<List<CommunicationResponseDTO>> findAllByVacancyId(@PathVariable("id") Integer id) Endpoint to retrieve a list of communications by vacancy ID.- Parameters:
id- The ID of the vacancy.- Returns:
- A
ResponseEntitywith a list ofCommunicationResponseDTOrepresenting communications by vacancy ID.
-