Class PollController

java.lang.Object
vaultWeb.controllers.PollController

@RestController @RequestMapping("/groups/{groupId}/polls") public class PollController extends Object
Controller for managing polls within a specific group. All endpoints are prefixed with /groups/{groupId}/polls.
  • Constructor Details

    • PollController

      public PollController()
  • Method Details

    • createPoll

      @PostMapping("") public org.springframework.http.ResponseEntity<PollResponseDto> createPoll(@PathVariable Long groupId, @RequestBody @Valid @Valid PollRequestDto pollDto)
      Creates a new poll in the specified group.
      Parameters:
      groupId - the ID of the group where the poll will be created
      pollDto - the poll data sent in the request body
      Returns:
      the created poll as a PollResponseDto
    • getPolls

      @GetMapping("") public org.springframework.http.ResponseEntity<List<PollResponseDto>> getPolls(@PathVariable Long groupId)
      Retrieves all polls of a given group.
      Parameters:
      groupId - the ID of the group
      Returns:
      list of PollResponseDto objects
    • vote

      @PostMapping("/{pollId}/options/{optionId}/vote") public org.springframework.http.ResponseEntity<Void> vote(@PathVariable Long groupId, @PathVariable Long pollId, @PathVariable Long optionId)
      Casts a vote for a specific poll option.
      Parameters:
      groupId - the ID of the group
      pollId - the ID of the poll
      optionId - the ID of the option being voted for
      Returns:
      HTTP 204 No Content
    • updatePoll

      @PutMapping("/{pollId}") public org.springframework.http.ResponseEntity<PollResponseDto> updatePoll(@PathVariable Long groupId, @PathVariable Long pollId, @RequestBody @Valid @Valid PollRequestDto pollDto)
      Updates an existing poll.
      Parameters:
      groupId - the ID of the group
      pollId - the ID of the poll to update
      pollDto - the new poll data
      Returns:
      updated PollResponseDto
    • deletePoll

      @DeleteMapping("/{pollId}") public org.springframework.http.ResponseEntity<Void> deletePoll(@PathVariable Long groupId, @PathVariable Long pollId)
      Deletes a poll from a group.
      Parameters:
      groupId - the ID of the group
      pollId - the ID of the poll to delete
      Returns:
      HTTP 204 No Content