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,32 +23,32 @@ definitions:
User: User:
type: object type: object
properties: properties:
id:
type: string
username: username:
type: string type: string
password: password:
type: string type: string
Authorization: Authorization:
type: object type: object
properties: properties:
to_date: username:
type: string type: string
format: date-time namespace:
from_date:
type: string type: string
format: date-time
user: AuthorizationItems:
type: string type: array
items:
$ref: "#/definitions/Authorization"
Election: Election:
type: object type: object
properties: properties:
id:
type: string
username: username:
type: string type: string
namespace:
type: string
name: name:
type: string type: string
description: description:
@ -67,8 +67,6 @@ definitions:
ElectionItem: ElectionItem:
type: object type: object
properties: properties:
id:
type: string
name: name:
type: string type: string
@ -76,7 +74,8 @@ definitions:
type: array type: array
items: items:
$ref: "#/definitions/Election" $ref: "#/definitions/Election"
VoteItem: VoteItem:
type: object type: object
properties: properties:
@ -88,8 +87,6 @@ definitions:
Vote: Vote:
type: object type: object
properties: properties:
authorization:
$ref: "#/definitions/Authorization"
userid: userid:
type: string type: string
data: data:
@ -128,7 +125,7 @@ paths:
401: 401:
description: Unauthorized description: Unauthorized
/auth/token: /auth/authorization:
post: post:
summary: Generate authentication token for another user summary: Generate authentication token for another user
consumes: consumes:
@ -144,10 +141,11 @@ paths:
format: JWT format: JWT
- in: body - in: body
name: token name: authorization
required: true required: true
schema: schema:
$ref: "#/definitions/Authorization" $ref: "#/definitions/Authorization"
responses: responses:
200: 200:
description: Token generated successfully description: Token generated successfully
@ -159,8 +157,55 @@ paths:
format: JWT format: JWT
401: 401:
description: Unauthorized 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: post:
summary: Create new election summary: Create new election
consumes: consumes:
@ -188,7 +233,6 @@ paths:
401: 401:
description: Unauthorized description: Unauthorized
/elections/all:
get: get:
summary: Get all existing elections summary: Get all existing elections
parameters: parameters: