Class PrivateChatPollController

java.lang.Object
vaultWeb.controllers.PrivateChatPollController

@RestController @RequestMapping("/api/private-chats/{privateChatId}/polls") public class PrivateChatPollController extends Object
  • Constructor Details

    • PrivateChatPollController

      public PrivateChatPollController()
  • Method Details

    • createPoll

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

      @PostMapping("/{pollId}/options/{optionId}/vote") public org.springframework.http.ResponseEntity<Void> vote(@PathVariable Long privateChatId, @PathVariable Long pollId, @PathVariable Long optionId)
      Casts a vote for a specific poll option.
      Parameters:
      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 privateChatId, @PathVariable Long pollId, @RequestBody @Valid @Valid PollRequestDto pollDto)
      Updates an existing poll.
      Parameters:
      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 privateChatId, @PathVariable Long pollId)
      Deletes a poll from a private chat.
      Parameters:
      pollId - the ID of the poll to delete
      Returns:
      HTTP 204 No Content
    • getPolls

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