diff --git a/openapi.yaml b/openapi.yaml index 5455c05..3bc0e6b 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -23,32 +23,32 @@ definitions: User: type: object properties: - id: - type: string username: type: string password: type: string - + Authorization: type: object properties: - to_date: + username: type: string - format: date-time - from_date: + namespace: type: string - format: date-time - user: - 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 @@ -76,7 +74,8 @@ definitions: type: array 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: