Move voting to a new endpoint

/election/{id}/votes
This commit is contained in:
2025-01-11 18:29:01 +01:00
parent 86d7d0e881
commit cad5cfe636
8 changed files with 186 additions and 100 deletions

View File

@ -58,6 +58,46 @@ paths:
schema:
$ref: "#/components/schemas/ErrorResponse"
/election/{id}/votes:
post:
tags:
- vote
summary: Cast your votes for an election
operationId: createVotes
parameters:
- name: id
in: path
required: true
description: The ID of the election
schema:
type: integer
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/CreateVotesRequest"
responses:
200:
description: Votes cast
404:
description: Election not found
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
422:
description: Unprocessable content
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
500:
description: Server error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/election/{id}/results:
get:
tags:
@ -90,33 +130,6 @@ paths:
schema:
$ref: "#/components/schemas/ErrorResponse"
/votes:
post:
tags:
- vote
summary: Cast your votes for an election
operationId: createVotes
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/CreateVotesRequest"
responses:
200:
description: Votes cast
422:
description: Unprocessable content
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
500:
description: Server error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
components:
schemas:
Election:
@ -266,14 +279,11 @@ components:
CreateVotesRequest:
type: object
required:
- electionId
- choices
properties:
voterIdentity:
type: string
description: Must be filled if election has known voters
electionId:
type: integer
choices:
type: array
items: