Class VacancyController

java.lang.Object
com.myhrcrmproject.controller.VacancyController

@RestController @RequestMapping("api/vacancies") public class VacancyController extends Object
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 Details

    • VacancyController

      public VacancyController()
  • Method Details

    • findAll

      @GetMapping public org.springframework.http.ResponseEntity<List<VacancyResponseDTO>> findAll()
      Retrieves a list of all vacancies.
      Returns:
      A ResponseEntity with 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 ResponseEntity with 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 ResponseEntity with 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 ResponseEntity with 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 ResponseEntity with 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 ResponseEntity with the list of vacancies and HTTP status code 200 (OK).