Skip to content

Commit ea0b292

Browse files
committed
투표참여 api
1 parent b59c69c commit ea0b292

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

polling-app-server/src/main/java/com/example/polls/controller/GroupPollController.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.example.polls.controller;
22

33
import com.example.polls.payload.Request.PollRequest;
4+
import com.example.polls.payload.Request.VoteRequest;
45
import com.example.polls.payload.Response.ApiResponse;
56
import com.example.polls.payload.Response.PagedResponse;
67
import com.example.polls.payload.Response.PollResponse;
@@ -49,4 +50,11 @@ public ResponseEntity<PollResponse> getPollByIdInGroup(@PathVariable Long groupI
4950
return ResponseEntity.ok(response);
5051
}
5152

53+
@PostMapping("/{pollId}/votes")
54+
public PollResponse castVote(@CurrentUser UserPrincipal userPrincipal,
55+
@PathVariable Long pollId,
56+
@Valid @RequestBody VoteRequest voteRequest){
57+
return pollService.castVoteAndGetUpdatedPoll(pollId, voteRequest, userPrincipal);
58+
}
59+
5260
}

0 commit comments

Comments
 (0)