Package com.myhrcrmproject.controller
Class VacancyController
java.lang.Object
com.myhrcrmproject.controller.VacancyController
Controller class for managing vacancy-related operations in the HR CRM system.
This class defines RESTful APIs for various vacancy actions, including retrieving all vacancies, finding a vacancy by ID, creating a new vacancy, updating an existing vacancy, deleting a vacancy, and retrieving vacancies by status or employee ID. It requires a manager role for certain operations.
Author: [Your Name]
- Version:
- 1.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<VacancyResponseDTO>createNew(VacancyRequestDTO requestDTO) Creates a new vacancy.voidDeletes a vacancy by its ID.org.springframework.http.ResponseEntity<List<VacancyResponseDTO>>findAll()Retrieves a list of all vacancies.org.springframework.http.ResponseEntity<List<VacancyShortResponseDTO>>Retrieves a list of vacancies by employee ID.org.springframework.http.ResponseEntity<List<VacancyResponseDTO>>findAllByStatus(Integer statusId) Retrieves a list of vacancies by status ID.org.springframework.http.ResponseEntity<VacancyResponseDTO>Retrieves a vacancy by its ID.org.springframework.http.ResponseEntity<VacancyResponseDTO>update(Integer id, VacancyRequestDTO requestDTO) Updates an existing vacancy.
-
Constructor Details
-
VacancyController
public VacancyController()
-
-
Method Details
-
findAll
Retrieves a list of all vacancies.- Returns:
- A
ResponseEntitywith the list of vacancies and HTTP status code 200 (OK).
-
findById
@GetMapping("/{id}") public org.springframework.http.ResponseEntity<VacancyResponseDTO> findById(@PathVariable("id") Integer id) Retrieves a vacancy by its ID.- Parameters:
id- The ID of the vacancy to retrieve.- Returns:
- A
ResponseEntitywith the vacancy details and HTTP status code 200 (OK).
-
createNew
@PostMapping public org.springframework.http.ResponseEntity<VacancyResponseDTO> createNew(@RequestBody VacancyRequestDTO requestDTO) Creates a new vacancy. Requires manager role.- Parameters:
requestDTO- The request body containing vacancy details.- Returns:
- A
ResponseEntitywith the created vacancy details and HTTP status code 201 (Created).
-
update
@PutMapping("/{id}") public org.springframework.http.ResponseEntity<VacancyResponseDTO> update(@PathVariable("id") Integer id, @RequestBody VacancyRequestDTO requestDTO) Updates an existing vacancy. Requires manager role.- Parameters:
id- The ID of the vacancy to update.requestDTO- The request body containing updated vacancy details.- Returns:
- A
ResponseEntitywith the updated vacancy details and HTTP status code 202 (Accepted).
-
delete
@DeleteMapping("/{id}") @ResponseStatus(NO_CONTENT) public void delete(@PathVariable("id") Integer id) Deletes a vacancy by its ID.- Parameters:
id- The ID of the vacancy to delete.
-
findAllByStatus
@GetMapping("/findAllByStatus/{id}") public org.springframework.http.ResponseEntity<List<VacancyResponseDTO>> findAllByStatus(@PathVariable("id") Integer statusId) Retrieves a list of vacancies by status ID. Requires manager role.- Parameters:
statusId- The ID of the status.- Returns:
- A
ResponseEntitywith the list of vacancies and HTTP status code 200 (OK).
-
findAllByEmployeeId
@GetMapping("/findAllByEmployee/{id}") public org.springframework.http.ResponseEntity<List<VacancyShortResponseDTO>> findAllByEmployeeId(@PathVariable("id") Integer id) Retrieves a list of vacancies by employee ID.- Parameters:
id- The ID of the employee.- Returns:
- A
ResponseEntitywith the list of vacancies and HTTP status code 200 (OK).
-