Update openapi.yaml

Done to not require tokens for authorization (instead do it serverside) and move them to a namespace instead of a datetime range.
This commit is contained in:
Adrian Gunnar Lauterer 2024-05-12 02:31:44 +02:00
parent 0246f22e3e
commit b2a0f85563
1 changed files with 65 additions and 21 deletions

View File

@ -23,8 +23,6 @@ definitions:
User:
type: object
properties:
id:
type: string
username:
type: string
password:
@ -33,22 +31,24 @@ definitions:
Authorization:
type: object
properties:
to_date:
username:
type: string
format: date-time
from_date:
type: string
format: date-time
user:
namespace:
type: string
AuthorizationItems:
type: array
items:
$ref: "#/definitions/Authorization"
Election:
type: object
properties:
id:
type: string
username:
type: string
namespace:
type: string
name:
type: string
description:
@ -67,8 +67,6 @@ definitions:
ElectionItem:
type: object
properties:
id:
type: string
name:
type: string
@ -77,6 +75,7 @@ definitions:
items:
$ref: "#/definitions/Election"
VoteItem:
type: object
properties:
@ -88,8 +87,6 @@ definitions:
Vote:
type: object
properties:
authorization:
$ref: "#/definitions/Authorization"
userid:
type: string
data:
@ -128,7 +125,7 @@ paths:
401:
description: Unauthorized
/auth/token:
/auth/authorization:
post:
summary: Generate authentication token for another user
consumes:
@ -144,10 +141,11 @@ paths:
format: JWT
- in: body
name: token
name: authorization
required: true
schema:
$ref: "#/definitions/Authorization"
responses:
200:
description: Token generated successfully
@ -159,8 +157,55 @@ paths:
format: JWT
401:
description: Unauthorized
get:
summary: Generate authentication token for another user
consumes:
- application/json
produces:
- application/json
parameters:
- in: header
name: Authorization
description: Your authorization token
required: true
type: string
format: JWT
/elections/create:
responses:
200:
description: List of authorizations you have gotten.
schema:
$ref: "#/definitions/AuthorizationItems"
401:
description: Unauthorized
delete:
summary: Delete all Authorization you have given to a user
consumes:
- application/json
produces:
- application/json
parameters:
- in: header
name: Authorization
description: Your authorization token
required: true
type: string
format: JWT
- in: body
name: Authorisation
description: The authorization token you want to delete
schema:
$ref: "#/definitions/Authorization"
responses:
200:
description: Sucsess
401:
description: Unauthorized
/elections:
post:
summary: Create new election
consumes:
@ -188,7 +233,6 @@ paths:
401:
description: Unauthorized
/elections/all:
get:
summary: Get all existing elections
parameters: