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 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 ResponseEntity with a list of CommunicationResponseDTO representing 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 ResponseEntity with the CommunicationResponseDTO representing 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 ResponseEntity with the CommunicationResponseDTO representing 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 ResponseEntity with the CommunicationResponseDTO representing 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 ResponseEntity with a list of CommunicationResponseDTO representing 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 ResponseEntity with a list of CommunicationResponseDTO representing 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 ResponseEntity with a list of CommunicationResponseDTO representing 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 ResponseEntity with a list of CommunicationResponseDTO representing 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 ResponseEntity with a list of CommunicationResponseDTO representing communications by vacancy ID.