|
|
|
@ -16,8 +16,8 @@ servers:
|
|
|
|
|
paths:
|
|
|
|
|
/polls:
|
|
|
|
|
get:
|
|
|
|
|
operationId: get-polls
|
|
|
|
|
summary: Gets all polls.
|
|
|
|
|
operationId: get-users
|
|
|
|
|
summary: Gets all users.
|
|
|
|
|
responses:
|
|
|
|
|
'200':
|
|
|
|
|
description: OK
|
|
|
|
@ -26,16 +26,16 @@ paths:
|
|
|
|
|
schema:
|
|
|
|
|
type: array
|
|
|
|
|
items:
|
|
|
|
|
$ref: '#/components/schemas/poll'
|
|
|
|
|
$ref: '#/components/schemas/user'
|
|
|
|
|
post:
|
|
|
|
|
operationId: create-poll
|
|
|
|
|
summary: Creates a poll.
|
|
|
|
|
operationId: create-user
|
|
|
|
|
summary: Creates an user
|
|
|
|
|
requestBody:
|
|
|
|
|
required: true
|
|
|
|
|
content:
|
|
|
|
|
application/json:
|
|
|
|
|
schema:
|
|
|
|
|
$ref: '#/components/schemas/poll'
|
|
|
|
|
$ref: '#/components/schemas/user'
|
|
|
|
|
responses:
|
|
|
|
|
'201':
|
|
|
|
|
description: Created
|
|
|
|
@ -46,20 +46,14 @@ paths:
|
|
|
|
|
properties:
|
|
|
|
|
id:
|
|
|
|
|
type: string
|
|
|
|
|
description: Id of the created poll.
|
|
|
|
|
description: Id of the created user.
|
|
|
|
|
links:
|
|
|
|
|
get-poll:
|
|
|
|
|
$ref: '#/components/links/get-poll'
|
|
|
|
|
update-poll:
|
|
|
|
|
$ref: '#/components/links/update-poll'
|
|
|
|
|
delete-poll:
|
|
|
|
|
$ref: '#/components/links/delete-poll'
|
|
|
|
|
create-ballot:
|
|
|
|
|
$ref: '#/components/links/create-ballot'
|
|
|
|
|
list-poll-results:
|
|
|
|
|
$ref: '#/components/links/list-poll-results'
|
|
|
|
|
'400':
|
|
|
|
|
description: Bad Request. Expect at least 2 proposals and a title.
|
|
|
|
|
get-user:
|
|
|
|
|
$ref: '#/components/links/get-user'
|
|
|
|
|
update-user:
|
|
|
|
|
$ref: '#/components/links/update-user'
|
|
|
|
|
delete-user:
|
|
|
|
|
$ref: '#/components/links/delete-user'
|
|
|
|
|
'/polls/{poll-id}':
|
|
|
|
|
parameters:
|
|
|
|
|
- in: path
|
|
|
|
@ -253,6 +247,103 @@ paths:
|
|
|
|
|
$ref: '#/components/schemas/result'
|
|
|
|
|
'404':
|
|
|
|
|
$ref: '#/components/responses/poll-not-found'
|
|
|
|
|
/users:
|
|
|
|
|
get:
|
|
|
|
|
operationId: get-polls
|
|
|
|
|
summary: Gets all polls.
|
|
|
|
|
responses:
|
|
|
|
|
'200':
|
|
|
|
|
description: OK
|
|
|
|
|
content:
|
|
|
|
|
application/json:
|
|
|
|
|
schema:
|
|
|
|
|
type: array
|
|
|
|
|
items:
|
|
|
|
|
$ref: '#/components/schemas/poll'
|
|
|
|
|
post:
|
|
|
|
|
operationId: create-poll
|
|
|
|
|
summary: Creates a poll.
|
|
|
|
|
requestBody:
|
|
|
|
|
required: true
|
|
|
|
|
content:
|
|
|
|
|
application/json:
|
|
|
|
|
schema:
|
|
|
|
|
$ref: '#/components/schemas/poll'
|
|
|
|
|
responses:
|
|
|
|
|
'201':
|
|
|
|
|
description: Created
|
|
|
|
|
content:
|
|
|
|
|
application/json:
|
|
|
|
|
schema:
|
|
|
|
|
type: object
|
|
|
|
|
properties:
|
|
|
|
|
id:
|
|
|
|
|
type: string
|
|
|
|
|
description: Id of the created poll.
|
|
|
|
|
links:
|
|
|
|
|
get-poll:
|
|
|
|
|
$ref: '#/components/links/get-poll'
|
|
|
|
|
update-poll:
|
|
|
|
|
$ref: '#/components/links/update-poll'
|
|
|
|
|
delete-poll:
|
|
|
|
|
$ref: '#/components/links/delete-poll'
|
|
|
|
|
create-ballot:
|
|
|
|
|
$ref: '#/components/links/create-ballot'
|
|
|
|
|
list-poll-results:
|
|
|
|
|
$ref: '#/components/links/list-poll-results'
|
|
|
|
|
'400':
|
|
|
|
|
description: Bad Request. Expect at least 2 proposals and a title.
|
|
|
|
|
'/users/{user-id}':
|
|
|
|
|
parameters:
|
|
|
|
|
- in: path
|
|
|
|
|
name: user-id
|
|
|
|
|
required: true
|
|
|
|
|
schema:
|
|
|
|
|
type: integer
|
|
|
|
|
format: int64
|
|
|
|
|
get:
|
|
|
|
|
operationId: get-user
|
|
|
|
|
summary: Gets a user by ID
|
|
|
|
|
responses:
|
|
|
|
|
'200':
|
|
|
|
|
description: OK
|
|
|
|
|
content:
|
|
|
|
|
application/json:
|
|
|
|
|
schema:
|
|
|
|
|
$ref: '#/components/schemas/user'
|
|
|
|
|
'404':
|
|
|
|
|
$ref: '#/components/responses/user-not-found'
|
|
|
|
|
patch:
|
|
|
|
|
operationId: update-user
|
|
|
|
|
summary: Updates a user
|
|
|
|
|
requestBody:
|
|
|
|
|
required: true
|
|
|
|
|
content:
|
|
|
|
|
application/json:
|
|
|
|
|
schema:
|
|
|
|
|
$ref: '#/components/schemas/user'
|
|
|
|
|
security:
|
|
|
|
|
- {}
|
|
|
|
|
- userAuth: []
|
|
|
|
|
responses:
|
|
|
|
|
'200':
|
|
|
|
|
description: OK
|
|
|
|
|
content:
|
|
|
|
|
application/json:
|
|
|
|
|
schema:
|
|
|
|
|
type: array
|
|
|
|
|
items:
|
|
|
|
|
$ref: '#/components/schemas/user'
|
|
|
|
|
delete:
|
|
|
|
|
operationId: delete-user
|
|
|
|
|
summary: Deletes a user
|
|
|
|
|
responses:
|
|
|
|
|
'200':
|
|
|
|
|
description: OK
|
|
|
|
|
'404':
|
|
|
|
|
$ref: '#/components/responses/user-not-found'
|
|
|
|
|
security:
|
|
|
|
|
- userAuth: []
|
|
|
|
|
components:
|
|
|
|
|
securitySchemes:
|
|
|
|
|
participantAuth:
|
|
|
|
@ -264,7 +355,28 @@ components:
|
|
|
|
|
resultAuth:
|
|
|
|
|
type: http
|
|
|
|
|
scheme: bearer
|
|
|
|
|
userAuth:
|
|
|
|
|
type: http
|
|
|
|
|
scheme: bearer
|
|
|
|
|
schemas:
|
|
|
|
|
user:
|
|
|
|
|
type: object
|
|
|
|
|
properties:
|
|
|
|
|
id:
|
|
|
|
|
type: integer
|
|
|
|
|
description: A unique identifier
|
|
|
|
|
example: 0
|
|
|
|
|
readOnly: true
|
|
|
|
|
name:
|
|
|
|
|
type: string
|
|
|
|
|
description: Unique user-name
|
|
|
|
|
example: john.doe
|
|
|
|
|
description:
|
|
|
|
|
type: string
|
|
|
|
|
description: An optional description of the user
|
|
|
|
|
example: >-
|
|
|
|
|
John Doe is a multiple-use name that is used when the true name of a
|
|
|
|
|
person is unknown or is being intentionally concealed
|
|
|
|
|
ballot:
|
|
|
|
|
type: object
|
|
|
|
|
properties:
|
|
|
|
@ -296,6 +408,10 @@ components:
|
|
|
|
|
description: The ballots received by this proposal.
|
|
|
|
|
items:
|
|
|
|
|
$ref: '#/components/schemas/ballot'
|
|
|
|
|
description:
|
|
|
|
|
type: string
|
|
|
|
|
description: An optional description of the proposal
|
|
|
|
|
example: This school would welcome 500 pupils.
|
|
|
|
|
mention:
|
|
|
|
|
type: object
|
|
|
|
|
properties:
|
|
|
|
@ -310,6 +426,10 @@ components:
|
|
|
|
|
Unique but short name of the mention, like "Excellent" or "To
|
|
|
|
|
reject".
|
|
|
|
|
example: Excellent
|
|
|
|
|
description:
|
|
|
|
|
type: string
|
|
|
|
|
description: An optional description of the mention
|
|
|
|
|
example: 'In this poll, the mention "To reject" disqualifies the proposal.'
|
|
|
|
|
participant:
|
|
|
|
|
type: object
|
|
|
|
|
properties:
|
|
|
|
@ -318,6 +438,10 @@ components:
|
|
|
|
|
description: A unique identifier
|
|
|
|
|
example: JtRm05yjMAuFCI2uwnFp
|
|
|
|
|
readOnly: true
|
|
|
|
|
description:
|
|
|
|
|
type: string
|
|
|
|
|
description: An optional description of the participant
|
|
|
|
|
example: John Doe
|
|
|
|
|
has-participed:
|
|
|
|
|
type: boolean
|
|
|
|
|
description: >-
|
|
|
|
@ -329,7 +453,7 @@ components:
|
|
|
|
|
description: The identifier of the poll that the participant participates on.
|
|
|
|
|
example: 1jDe1e5eF_IkaYPuoIYX
|
|
|
|
|
mail:
|
|
|
|
|
type: object
|
|
|
|
|
type: string
|
|
|
|
|
description: >-
|
|
|
|
|
The mail that will eventually created at the creation of the
|
|
|
|
|
participant (not kept in memory).
|
|
|
|
@ -346,6 +470,10 @@ components:
|
|
|
|
|
type: string
|
|
|
|
|
example: What project should our neighbourhood invest in for the next year?
|
|
|
|
|
description: The title of the poll
|
|
|
|
|
description:
|
|
|
|
|
type: string
|
|
|
|
|
description: A description of the poll
|
|
|
|
|
example: null
|
|
|
|
|
proposals:
|
|
|
|
|
type: array
|
|
|
|
|
description: The proposals being voted in a poll.
|
|
|
|
@ -365,7 +493,10 @@ components:
|
|
|
|
|
description: The participants that are allowed to participate to the election.
|
|
|
|
|
items:
|
|
|
|
|
$ref: '#/components/schemas/participant'
|
|
|
|
|
restrict_participants:
|
|
|
|
|
user-id:
|
|
|
|
|
type: string
|
|
|
|
|
description: 'Organizer id. If not given, a dummy user is created.'
|
|
|
|
|
restrict-participants:
|
|
|
|
|
type: boolean
|
|
|
|
|
description: 'True if anyone can participate to this poll, False otherwise.'
|
|
|
|
|
example: false
|
|
|
|
@ -406,6 +537,41 @@ components:
|
|
|
|
|
type: integer
|
|
|
|
|
format: int16
|
|
|
|
|
links:
|
|
|
|
|
get-user:
|
|
|
|
|
operationId: get-user
|
|
|
|
|
parameters:
|
|
|
|
|
userId: $response.body#/id
|
|
|
|
|
description: >
|
|
|
|
|
The `id` value returned in the response can be used as the `user-id`
|
|
|
|
|
parameter in GET /users/{user-id}.
|
|
|
|
|
update-user:
|
|
|
|
|
operationId: update-user
|
|
|
|
|
parameters:
|
|
|
|
|
userId: $response.body#/id
|
|
|
|
|
description: >
|
|
|
|
|
The `id` value returned in the response can be used as the `user-id`
|
|
|
|
|
parameter in PATCH /users/{user-id}.
|
|
|
|
|
delete-user:
|
|
|
|
|
operationId: delete-user
|
|
|
|
|
parameters:
|
|
|
|
|
userId: $response.body#/id
|
|
|
|
|
description: >
|
|
|
|
|
The `id` value returned in the response can be used as the `user-id`
|
|
|
|
|
parameter in DELETE /users/{user-id}.
|
|
|
|
|
get-ballot:
|
|
|
|
|
operationId: get-ballot
|
|
|
|
|
parameters:
|
|
|
|
|
ballotId: $response.body#/id
|
|
|
|
|
description: >
|
|
|
|
|
The `id` value returned in the response can be used as the `ballot-id`
|
|
|
|
|
parameter in GET /polls/{poll-id}/ballots/{ballot-id}.
|
|
|
|
|
delete-ballot:
|
|
|
|
|
operationId: delete-ballot
|
|
|
|
|
parameters:
|
|
|
|
|
ballotId: $response.body#/id
|
|
|
|
|
description: >
|
|
|
|
|
The `id` value returned in the response can be used as the `ballot-id`
|
|
|
|
|
parameter in DELETE /polls/{poll-id}/ballots/{ballot-id}.
|
|
|
|
|
get-poll:
|
|
|
|
|
operationId: get-poll
|
|
|
|
|
parameters:
|
|
|
|
@ -441,20 +607,6 @@ components:
|
|
|
|
|
description: >
|
|
|
|
|
The `id` value returned in the response can be used as the `poll-id`
|
|
|
|
|
parameter in GET /polls/{poll-id}/results.
|
|
|
|
|
get-ballot:
|
|
|
|
|
operationId: get-ballot
|
|
|
|
|
parameters:
|
|
|
|
|
ballotId: $response.body#/id
|
|
|
|
|
description: >
|
|
|
|
|
The `id` value returned in the response can be used as the `ballot-id`
|
|
|
|
|
parameter in GET /polls/{poll-id}/ballots/{ballot-id}.
|
|
|
|
|
delete-ballot:
|
|
|
|
|
operationId: delete-ballot
|
|
|
|
|
parameters:
|
|
|
|
|
ballotId: $response.body#/id
|
|
|
|
|
description: >
|
|
|
|
|
The `id` value returned in the response can be used as the `ballot-id`
|
|
|
|
|
parameter in DELETE /polls/{poll-id}/ballots/{ballot-id}.
|
|
|
|
|
responses:
|
|
|
|
|
poll-not-found:
|
|
|
|
|
description: The specified poll was not found
|
|
|
|
@ -474,3 +626,9 @@ components:
|
|
|
|
|
application/json:
|
|
|
|
|
schema:
|
|
|
|
|
$ref: '#/components/schemas/error'
|
|
|
|
|
user-not-found:
|
|
|
|
|
description: The specified user was not found
|
|
|
|
|
content:
|
|
|
|
|
application/json:
|
|
|
|
|
schema:
|
|
|
|
|
$ref: '#/components/schemas/error'
|
|
|
|
|