Package com.myhrcrmproject.controller
Class TaskController
java.lang.Object
com.myhrcrmproject.controller.TaskController
Controller class for managing task-related operations in the HR CRM system.
This class defines RESTful APIs for various task actions, including retrieving all tasks, finding tasks by ID, creating new tasks, updating existing tasks, and deleting tasks.
Additionally, it provides endpoints to retrieve tasks based on different criteria such as task status ID, employee ID, candidate ID, vacancy ID, start date, etc.
- Version:
- 1.0
- Author:
- Denys Chaykovskyy
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<TaskResponseDTO>createNew(TaskRequestDTO requestDTO) Endpoint to create a new task.voidEndpoint to delete a task.org.springframework.http.ResponseEntity<List<TaskResponseDTO>>findAll()Endpoint to retrieve a list of all tasks Requires manager role.org.springframework.http.ResponseEntity<List<TaskResponseDTO>>Retrieves a list of tasks by candidate ID.org.springframework.http.ResponseEntity<List<TaskShortResponseDTO>>findAllByCandidateIdAndEmployeeId(Integer candidateId, Integer employeeId) Retrieves a list of tasks by candidate ID and employee ID.org.springframework.http.ResponseEntity<List<TaskResponseDTO>>Retrieves a list of tasks by employee ID.org.springframework.http.ResponseEntity<List<TaskResponseDTO>>findAllByStartDate(TaskDateRequestDTO requestDTO) Retrieves a list of tasks by start date.org.springframework.http.ResponseEntity<List<TaskShortResponseDTO>>findAllByStartDateAndEmployeeId(Integer id, TaskDateRequestDTO requestDTO) Retrieves a list of tasks by start date and employee ID.org.springframework.http.ResponseEntity<List<TaskShortResponseDTO>>findAllByStatusIdAndEmployeeId(Integer statusId, Integer employeeId) Retrieves a list of tasks by status ID and employee ID.org.springframework.http.ResponseEntity<List<TaskResponseDTO>>Retrieves a list of tasks by task status ID.org.springframework.http.ResponseEntity<List<TaskResponseDTO>>Retrieves a list of tasks by vacancy ID.org.springframework.http.ResponseEntity<List<TaskShortResponseDTO>>findAllByVacancyIdAndEmployeeId(Integer vacancyId, Integer employeeId) Retrieves a list of tasks by vacancy ID and employee ID.org.springframework.http.ResponseEntity<TaskResponseDTO>Endpoint to retrieve a task by its ID.org.springframework.http.ResponseEntity<TaskResponseDTO>update(Integer id, TaskRequestDTO requestDTO) Endpoint to update an existing task.
-
Constructor Details
-
TaskController
public TaskController()
-
-
Method Details
-
findAll
Endpoint to retrieve a list of all tasks Requires manager role.- Returns:
- A
ResponseEntitywith a list ofTaskResponseDTOrepresenting all tasks.
-
findById
@GetMapping("/{id}") public org.springframework.http.ResponseEntity<TaskResponseDTO> findById(@PathVariable("id") Integer id) Endpoint to retrieve a task by its ID.- Parameters:
id- The ID of the task to retrieve.- Returns:
- A
ResponseEntitywith theTaskResponseDTOrepresenting the retrieved task.
-
createNew
@PostMapping public org.springframework.http.ResponseEntity<TaskResponseDTO> createNew(@RequestBody TaskRequestDTO requestDTO) Endpoint to create a new task.- Parameters:
requestDTO- The request body containing task details.- Returns:
- A
ResponseEntitywith theTaskResponseDTOrepresenting the newly created task.
-
update
@PutMapping("/{id}") public org.springframework.http.ResponseEntity<TaskResponseDTO> update(@PathVariable("id") Integer id, @RequestBody TaskRequestDTO requestDTO) Endpoint to update an existing task.- Parameters:
id- The ID of the task to update.requestDTO- The request body containing updated task details.- Returns:
- A
ResponseEntitywith theTaskResponseDTOrepresenting the updated task.
-
delete
@DeleteMapping("/{id}") @ResponseStatus(NO_CONTENT) public void delete(@PathVariable("id") Integer id) Endpoint to delete a task.- Parameters:
id- The ID of the task to delete.
-
findAllByTaskStatusId
@GetMapping("/findAllByTaskStatusId/{id}") public org.springframework.http.ResponseEntity<List<TaskResponseDTO>> findAllByTaskStatusId(@PathVariable("id") Integer id) Retrieves a list of tasks by task status ID. Requires manager role.- Parameters:
id- The ID of the status.- Returns:
- A
ResponseEntitywith the list of tasks and HTTP status code 200 (OK).
-
findAllByEmployeeId
@GetMapping("/findAllByEmployee/{id}") public org.springframework.http.ResponseEntity<List<TaskResponseDTO>> findAllByEmployeeId(@PathVariable("id") Integer id) Retrieves a list of tasks by employee ID.- Parameters:
id- The ID of the employee.- Returns:
- A
ResponseEntitywith the list of tasks and HTTP status code 200 (OK).
-
findAllByCandidateId
@GetMapping("/findAllByCandidate/{id}") public org.springframework.http.ResponseEntity<List<TaskResponseDTO>> findAllByCandidateId(@PathVariable("id") Integer id) Retrieves a list of tasks by candidate ID. Requires manager role.- Parameters:
id- The ID of the candidate.- Returns:
- A
ResponseEntitywith the list of tasks and HTTP status code 200 (OK).
-
findAllByVacancyId
@GetMapping("/findAllByVacancy/{id}") public org.springframework.http.ResponseEntity<List<TaskResponseDTO>> findAllByVacancyId(@PathVariable("id") Integer id) Retrieves a list of tasks by vacancy ID. Requires manager role.- Parameters:
id- The ID of the vacancy.- Returns:
- A
ResponseEntitywith the list of tasks and HTTP status code 200 (OK).
-
findAllByStartDate
@PutMapping("/findAllByStartDate") public org.springframework.http.ResponseEntity<List<TaskResponseDTO>> findAllByStartDate(@RequestBody TaskDateRequestDTO requestDTO) Retrieves a list of tasks by start date. Requires manager role.- Parameters:
requestDTO- The request body containing start date.- Returns:
- A
ResponseEntitywith the list of tasks and HTTP status code 200 (OK).
-
findAllByStartDateAndEmployeeId
@PutMapping("/findAllByStartDateAndEmployee/{id}") public org.springframework.http.ResponseEntity<List<TaskShortResponseDTO>> findAllByStartDateAndEmployeeId(@PathVariable("id") Integer id, @RequestBody TaskDateRequestDTO requestDTO) Retrieves a list of tasks by start date and employee ID.- Parameters:
id- The ID of the employee.requestDTO- The request body containing start date.- Returns:
- A
ResponseEntitywith the list of tasks and HTTP status code 200 (OK).
-
findAllByCandidateIdAndEmployeeId
@GetMapping("/findAllByCandidateAndEmployee/{candidateId}/{employeeId}") public org.springframework.http.ResponseEntity<List<TaskShortResponseDTO>> findAllByCandidateIdAndEmployeeId(@PathVariable("candidateId") Integer candidateId, @PathVariable("employeeId") Integer employeeId) Retrieves a list of tasks by candidate ID and employee ID.- Parameters:
candidateId- The ID of the candidate.employeeId- The ID of the employee.- Returns:
- A
ResponseEntitywith the list of tasks and HTTP status code 200 (OK).
-
findAllByStatusIdAndEmployeeId
@GetMapping("/findAllByStatusAndEmployee/{statusId}/{employeeId}") public org.springframework.http.ResponseEntity<List<TaskShortResponseDTO>> findAllByStatusIdAndEmployeeId(@PathVariable("statusId") Integer statusId, @PathVariable("employeeId") Integer employeeId) Retrieves a list of tasks by status ID and employee ID.- Parameters:
statusId- The ID of task status.employeeId- The ID of the employee.- Returns:
- A
ResponseEntitywith the list of tasks and HTTP status code 200 (OK).
-
findAllByVacancyIdAndEmployeeId
@GetMapping("/findAllByVacancyAndEmployee/{vacancyId}/{employeeId}") public org.springframework.http.ResponseEntity<List<TaskShortResponseDTO>> findAllByVacancyIdAndEmployeeId(@PathVariable("vacancyId") Integer vacancyId, @PathVariable("employeeId") Integer employeeId) Retrieves a list of tasks by vacancy ID and employee ID.- Parameters:
vacancyId- The ID of the vacancy.employeeId- The ID of the employee.- Returns:
- A
ResponseEntitywith the list of tasks and HTTP status code 200 (OK).
-