Add some more tests and implement getElection

This commit is contained in:
2025-01-17 14:49:51 +01:00
parent 60d1bb382c
commit 410e8f39d3
6 changed files with 236 additions and 1 deletions

View File

@ -22,6 +22,38 @@ tags:
description: Retrieve data related to votes
paths:
/election/{id}:
get:
tags:
- election
summary: Get an election
operationId: getElection
parameters:
- name: id
in: path
required: true
description: The ID of the election
schema:
type: integer
responses:
200:
description: Election returned
content:
application/json:
schema:
$ref: "#/components/schemas/Election"
400:
description: Request malformed
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
404:
description: Election not found
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
/election:
post:
tags:
@ -77,7 +109,7 @@ paths:
schema:
$ref: "#/components/schemas/CreateVotesRequest"
responses:
200:
201:
description: Votes cast
400:
description: Request malformed
@ -145,6 +177,37 @@ paths:
components:
schemas:
Election:
type: object
required:
- id
- name
- tokens
- areVotersKnown
- maxVoters
- createdAt
- expiresAt
- choices
properties:
id:
type: integer
name:
type: string
tokens:
type: integer
areVotersKnown:
type: boolean
maxVoters:
type: integer
createdAt:
type: string
expiresAt:
type: string
choices:
type: array
items:
type: string
CreateElectionRequest:
type: object
required: