Class CompensationController

java.lang.Object
com.myhrcrmproject.controller.CompensationController

@RestController @RequestMapping("api/compensations") public class CompensationController extends Object
Controller class for managing compensation-related operations in the HR CRM system.

This class provides RESTful endpoints for retrieving, creating, updating, and deleting compensation records. It interacts with the CompensationService for handling business logic and data access.

Additionally, it includes endpoints for finding compensations by their ID, retrieving a list of all compensations, creating a new compensation, updating an existing compensation, and deleting a compensation. There are also endpoints for finding compensations 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/compensations" endpoint.

Version:
1.0
Author:
Denys Chaykovskyy
  • Constructor Details

    • CompensationController

      public CompensationController()
  • Method Details

    • findAll

      @GetMapping public org.springframework.http.ResponseEntity<List<CompensationResponseDTO>> findAll()
      Endpoint to retrieve a list of all compensations.
      Returns:
      A ResponseEntity with a list of CompensationResponseDTO representing all compensations.
    • findById

      @GetMapping("/{id}") public org.springframework.http.ResponseEntity<CompensationResponseDTO> findById(@PathVariable("id") Integer id)
      Endpoint to retrieve a compensation by its ID.
      Parameters:
      id - The ID of the compensation to retrieve.
      Returns:
      A ResponseEntity with the CompensationResponseDTO representing the retrieved compensation.
    • createNew

      @PostMapping public org.springframework.http.ResponseEntity<CompensationResponseDTO> createNew(@RequestBody CompensationRequestDTO requestDTO)
      Endpoint to create a new compensation.
      Parameters:
      requestDTO - The request body containing compensation details.
      Returns:
      A ResponseEntity with the CompensationResponseDTO representing the newly created compensation.
    • update

      @PutMapping("/{id}") public org.springframework.http.ResponseEntity<CompensationResponseDTO> update(@PathVariable("id") Integer id, @RequestBody CompensationRequestDTO requestDTO)
      Endpoint to update an existing compensation.
      Parameters:
      id - The ID of the compensation to update.
      requestDTO - The request body containing updated compensation details.
      Returns:
      A ResponseEntity with the CompensationResponseDTO representing the updated compensation.
    • delete

      @DeleteMapping("/{id}") @ResponseStatus(NO_CONTENT) public void delete(@PathVariable("id") Integer id)
      Endpoint to delete a compensation.
      Parameters:
      id - The ID of the compensation to delete.
    • findAllByCandidateId

      @GetMapping("/findAllByCandidate/{id}") public org.springframework.http.ResponseEntity<List<CompensationShortResponseDTO>> findAllByCandidateId(@PathVariable("id") Integer id)
      Endpoint to retrieve a list of compensations by candidate ID.
      Parameters:
      id - The ID of the candidate.
      Returns:
      A ResponseEntity with a list of CompensationResponseDTO representing compensations by candiddate ID.
    • findAllByContractId

      @GetMapping("/findAllByContract/{id}") public org.springframework.http.ResponseEntity<List<CompensationShortResponseDTO>> findAllByContractId(@PathVariable("id") Integer id)
      Endpoint to retrieve a list of compensations by contract ID.
      Parameters:
      id - The ID of the contract.
      Returns:
      A ResponseEntity with a list of CompensationResponseDTO representing compensations by contract ID.