Package com.myhrcrmproject.controller
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<CompensationResponseDTO>createNew(CompensationRequestDTO requestDTO) Endpoint to create a new compensation.voidEndpoint to delete a compensation.org.springframework.http.ResponseEntity<List<CompensationResponseDTO>>findAll()Endpoint to retrieve a list of all compensations.org.springframework.http.ResponseEntity<List<CompensationShortResponseDTO>>Endpoint to retrieve a list of compensations by candidate ID.org.springframework.http.ResponseEntity<List<CompensationShortResponseDTO>>Endpoint to retrieve a list of compensations by contract ID.org.springframework.http.ResponseEntity<CompensationResponseDTO>Endpoint to retrieve a compensation by its ID.org.springframework.http.ResponseEntity<CompensationResponseDTO>update(Integer id, CompensationRequestDTO requestDTO) Endpoint to update an existing compensation.
-
Constructor Details
-
CompensationController
public CompensationController()
-
-
Method Details
-
findAll
Endpoint to retrieve a list of all compensations.- Returns:
- A
ResponseEntitywith a list ofCompensationResponseDTOrepresenting 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
ResponseEntitywith theCompensationResponseDTOrepresenting 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
ResponseEntitywith theCompensationResponseDTOrepresenting 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
ResponseEntitywith theCompensationResponseDTOrepresenting 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
ResponseEntitywith a list ofCompensationResponseDTOrepresenting 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
ResponseEntitywith a list ofCompensationResponseDTOrepresenting compensations by contract ID.
-