> For the complete documentation index, see [llms.txt](https://bible.cornellappdev.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bible.cornellappdev.com/api/pollo.md).

# Pollo

Documentation for Pollo

## General

## Generate a group code

<mark style="color:blue;">`GET`</mark> `http://pollo-backend.cornellappdev.com/api/v2/generate/code/`

#### Headers

| Name           | Type   | Description               |
| -------------- | ------ | ------------------------- |
| Authentication | string | `'Bearer ' + accessToken` |

{% tabs %}
{% tab title="200 " %}

```javascript
{
    success: true,
    data: {
        code: string
    }
}
```

{% endtab %}
{% endtabs %}

## Drafts

```javascript
type Draft {
    id: number,
    createdAt?: number,
    text: string,
    options: string[]
}
```

{% hint style="info" %}
If `options` are empty, assume free response question.
{% endhint %}

## Get all drafts for a user

<mark style="color:blue;">`GET`</mark> `http://pollo-backend.cornellappdev.com/api/v2/drafts/`

#### Headers

| Name           | Type   | Description               |
| -------------- | ------ | ------------------------- |
| Authentication | string | `'Bearer ' + accessToken` |

{% tabs %}
{% tab title="200 " %}

```javascript
{
    success: true,
    data: List<Draft>
}
```

{% endtab %}
{% endtabs %}

## Create a draft

<mark style="color:green;">`POST`</mark> `http://pollo-backend.cornellappdev.com/api/v2/drafts/`

#### Query Parameters

| Name    | Type   | Description |
| ------- | ------ | ----------- |
| text    | string |             |
| options | array  | string\[]   |

#### Headers

| Name           | Type   | Description               |
| -------------- | ------ | ------------------------- |
| Authentication | string | `'Bearer ' + accessToken` |

{% tabs %}
{% tab title="200 " %}

```javascript
{
    success: true,
    data: <Draft>
}
```

{% endtab %}
{% endtabs %}

## Update a draft

<mark style="color:orange;">`PUT`</mark> `http://pollo-backend.cornellappdev.com/api/v2/drafts/:id`

#### Path Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
| id   | string |             |

#### Query Parameters

| Name    | Type   | Description |
| ------- | ------ | ----------- |
| text    | string |             |
| options | array  | string\[]   |

#### Headers

| Name           | Type   | Description               |
| -------------- | ------ | ------------------------- |
| Authentication | string | `'Bearer ' + accessToken` |

{% tabs %}
{% tab title="200 " %}

```javascript
{
    success: true,
    data: <Draft>
}
```

{% endtab %}
{% endtabs %}

## Delete a draft

<mark style="color:red;">`DELETE`</mark> `http://pollo-backend.cornellappdev.com/api/v2/drafts/:id`

#### Path Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
| id   | string |             |

#### Headers

| Name           | Type   | Description               |
| -------------- | ------ | ------------------------- |
| Authentication | string | `'Bearer ' + accessToken` |

{% tabs %}
{% tab title="204 " %}

```javascript
{
    success: true,
    data: null
}
```

{% endtab %}
{% endtabs %}

## Groups

```
type Group {
    id: number,
    name: string,
    code: string,
    updatedAt: number,
    isLive: boolean
}
```

{% hint style="info" %}
Previously known as Session.
{% endhint %}

## Create a group

<mark style="color:green;">`POST`</mark> `http://pollo-backend.cornellappdev.com/api/v2/sessions/`

#### Query Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
| name | string |             |
| code | string |             |

#### Headers

| Name           | Type   | Description               |
| -------------- | ------ | ------------------------- |
| Authentication | string | `'Bearer ' + accessToken` |

{% tabs %}
{% tab title="200 " %}

```javascript
{
    success: true,
    data: <Group>
}
```

{% endtab %}
{% endtabs %}

## Get a group

<mark style="color:blue;">`GET`</mark> `http://pollo-backend.cornellappdev.com/api/v2/sessions/:id`

#### Path Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
| id   | string |             |

#### Headers

| Name           | Type   | Description               |
| -------------- | ------ | ------------------------- |
| Authentication | string | `'Bearer ' + accessToken` |

{% tabs %}
{% tab title="200 " %}

```javascript
{
    success: true,
    data: <Group>
}
```

{% endtab %}
{% endtabs %}

## Get all groups

<mark style="color:blue;">`GET`</mark> `http://pollo-backend.cornellappdev.com/api/v2/sessions/all/:role`

#### Path Parameters

| Name | Type   | Description                                                                                                                       |
| ---- | ------ | --------------------------------------------------------------------------------------------------------------------------------- |
| role | string | If role is `member`, this will return all groups you are in. If role is `admin`, this will return all groups you are an admin of. |

#### Headers

| Name          | Type   | Description               |
| ------------- | ------ | ------------------------- |
| Authorization | string | `'Bearer ' + accessToken` |

{% tabs %}
{% tab title="200 " %}

```javascript
{
    success: true,
    data: List<Group>
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
Each of the Group nodes has an extra field called `updatedAt`indicating the latest activity in Unix time & field called `isLive` indicating whether the group is live or not.
{% endhint %}

## Update a group

<mark style="color:orange;">`PUT`</mark> `http://pollo-backend.cornellappdev.com/api/v2/sessions/:id/`

#### Path Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
| id   | string |             |

#### Query Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
| name | string |             |

#### Headers

| Name          | Type   | Description               |
| ------------- | ------ | ------------------------- |
| Authorization | string | `'Bearer ' + accessToken` |

{% tabs %}
{% tab title="200 " %}

```javascript
{
    success: true,
    data: <Group>
}
```

{% endtab %}
{% endtabs %}

## Delete a group

<mark style="color:red;">`DELETE`</mark> `http://pollo-backend.cornellappdev.com/api/v2/sessions/:id/`

#### Path Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
| id   | string |             |

#### Headers

| Name          | Type   | Description               |
| ------------- | ------ | ------------------------- |
| Authorization | string | `'Bearer ' + accessToken` |

{% tabs %}
{% tab title="204 " %}

```javascript
{
    success: true,
    data: null
}
```

{% endtab %}
{% endtabs %}

## Leave a group

<mark style="color:red;">`DELETE`</mark> `http://pollo-backend.cornellappdev.com/api/v2/sessions/:id/members/`

#### Path Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
| id   | string |             |

#### Headers

| Name          | Type   | Description               |
| ------------- | ------ | ------------------------- |
| Authorization | string | `'Bearer ' + accessToken` |

{% tabs %}
{% tab title="204 " %}

```javascript
{
    success: true,
    data: null
}
```

{% endtab %}
{% endtabs %}

## Get members

<mark style="color:blue;">`GET`</mark> `http://pollo-backend.cornellappdev.com/api/v2/sessions/:id/members/`

#### Path Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
| id   | string |             |

#### Headers

| Name          | Type   | Description               |
| ------------- | ------ | ------------------------- |
| Authorization | string | `'Bearer ' + accessToken` |

{% tabs %}
{% tab title="200 " %}

```javascript
{
    success: true,
    data: List<User>
}
```

{% endtab %}
{% endtabs %}

## Get admins

<mark style="color:blue;">`GET`</mark> `http://pollo-backend.cornellappdev.com/api/v2/sessions/:id/admins/`

#### Path Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
| id   | string |             |

#### Headers

| Name          | Type   | Description               |
| ------------- | ------ | ------------------------- |
| Authorization | string | `'Bearer ' + accessToken` |

{% tabs %}
{% tab title="200 " %}

```javascript
{
    success: true,
    data: List<User>
}
```

{% endtab %}
{% endtabs %}

## Add members

<mark style="color:green;">`POST`</mark> `http://pollo-backend.cornellappdev.com/api/v2/sessions/:id/members/`

#### Path Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
| id   | string |             |

#### Query Parameters

| Name      | Type  | Description       |
| --------- | ----- | ----------------- |
| memberIDs | array | <p>int\[]<br></p> |

#### Headers

| Name          | Type   | Description               |
| ------------- | ------ | ------------------------- |
| Authorization | string | `'Bearer ' + accessToken` |

{% tabs %}
{% tab title="204 " %}

```javascript
{
    success: true,
    data: null
}
```

{% endtab %}
{% endtabs %}

## Remove members

<mark style="color:red;">`DELETE`</mark> `http://pollo-backend.cornellappdev.com/api/v2/sessions/:id/members/`

#### Path Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
| id   | string |             |

#### Query Parameters

| Name      | Type  | Description |
| --------- | ----- | ----------- |
| memberIDs | array | int\[]      |

#### Headers

| Name          | Type   | Description               |
| ------------- | ------ | ------------------------- |
| Authorization | string | `'Bearer ' + accessToken` |

{% tabs %}
{% tab title="204 " %}

```javascript
{
    success: true,
    data: null
}
```

{% endtab %}
{% endtabs %}

## Add admins

<mark style="color:green;">`POST`</mark> `http://pollo-backend.cornellappdev.com/api/v2/sessions/:id/admins/`

#### Path Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
| id   | string |             |

#### Query Parameters

| Name     | Type  | Description |
| -------- | ----- | ----------- |
| adminIDs | array | int\[]      |

#### Headers

| Name          | Type   | Description               |
| ------------- | ------ | ------------------------- |
| Authorization | string | `'Bearer ' + accessToken` |

{% tabs %}
{% tab title="204 " %}

```javascript
{
    success: true,
    data: null
}
```

{% endtab %}
{% endtabs %}

## Remove admins

<mark style="color:orange;">`PUT`</mark> `http://pollo-backend.cornellappdev.com/api/v2/sessions/:id/admins/`

#### Path Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
| id   | string |             |

#### Query Parameters

| Name     | Type  | Description |
| -------- | ----- | ----------- |
| adminIDs | array | int\[]      |

#### Headers

| Name          | Type   | Description               |
| ------------- | ------ | ------------------------- |
| Authorization | string | `'Bearer ' + accessToken` |

{% tabs %}
{% tab title="204 " %}

```javascript
{
    success: true,
    data: null
}
```

{% endtab %}
{% endtabs %}

## Polls

```
type Poll {
  id: number,
  text: string,
  results: json,
  shared: boolean,
  type: string, // MULTIPLE_CHOICE OR FREE_RESPONSE
  answer: ?string[],
  correctAnswer: string
}
```

{% hint style="info" %}
`Answer` is the user’s answer for that specific question. `null` if the user is the admin of the question. For multiple choice, answer is the choice. For free response, answer is an array of answer ids.

`correctAnswer` is the correct answer choice for multiple choice (ex. `correctAnswer: 'A'` ). Empty string if no correct answer selected for multiple choice or the question is free response.&#x20;
{% endhint %}

## Create a poll

<mark style="color:green;">`POST`</mark> `http://pollo-backend.cornellappdev.com/api/v2/sessions/:id/polls/`

#### Path Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
| id   | string |             |

#### Headers

| Name          | Type   | Description               |
| ------------- | ------ | ------------------------- |
| Authorization | string | `'Bearer ' + accessToken` |

#### Request Body

| Name    | Type    | Description |
| ------- | ------- | ----------- |
| type    | string  |             |
| text    | string  |             |
| results | object  | json        |
| shared  | boolean |             |

{% tabs %}
{% tab title="200 " %}

```javascript
{
    success: true,
    data: <Poll>
}
```

{% endtab %}
{% endtabs %}

## Get a poll

<mark style="color:blue;">`GET`</mark> `http://pollo-backend.cornellappdev.com/api/v2/polls/:id/`

#### Path Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
| id   | string |             |

#### Headers

| Name          | Type   | Description               |
| ------------- | ------ | ------------------------- |
| Authorization | string | `'Bearer ' + accessToken` |

{% tabs %}
{% tab title="200 " %}

```javascript
{
    success: true,
    data: <Poll>
}
```

{% endtab %}
{% endtabs %}

## Get all polls for a group sorted by date (ascending)

<mark style="color:blue;">`GET`</mark> `http://pollo-backend.cornellappdev.com/api/v2/sessions/:id/polls/`

Admin user will receive all polls\
Member user will receive all polls but with poll results hidden (set to `{}`) if poll is unshared

#### Path Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
| id   | string |             |

#### Headers

| Name          | Type   | Description               |
| ------------- | ------ | ------------------------- |
| Authorization | string | `'Bearer ' + accessToken` |

{% tabs %}
{% tab title="200 An array of objects with a date (Unix time) and the date's polls" %}

```javascript
{
  success: true,
  data: [ 
    {
      date: "1551846479",
      polls: [
        {
          "id": 9,
          "text": "question!",
          "results": {},
          "shared": true,
          "type": "MULTIPLE_CHOICE",
          "answer": ["A"]
        }
      ]
    }
  ]
}
```

{% endtab %}
{% endtabs %}

## Update a poll

<mark style="color:orange;">`PUT`</mark> `http://pollo-backend.cornellappdev.com/api/v2/polls/:id/`

#### Path Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
| id   | string |             |

#### Headers

| Name          | Type   | Description               |
| ------------- | ------ | ------------------------- |
| Authorization | string | `'Bearer ' + accessToken` |

#### Request Body

| Name    | Type    | Description |
| ------- | ------- | ----------- |
| text    | string  |             |
| results | string  |             |
| shared  | boolean |             |

{% tabs %}
{% tab title="200 The updated poll" %}

```javascript
{
    success: true,
    data: <Poll>
}
```

{% endtab %}
{% endtabs %}

## Delete a poll

<mark style="color:red;">`DELETE`</mark> `http://pollo-backend.cornellappdev.com/api/v2/polls/:id/`

#### Path Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
| id   | string |             |

#### Headers

| Name          | Type   | Description               |
| ------------- | ------ | ------------------------- |
| Authorization | string | `'Bearer ' + accessToken` |

{% tabs %}
{% tab title="204 " %}

```javascript
{
    success: true,
    data: null
}
```

{% endtab %}
{% endtabs %}

## Questions

```
type Question {
    id: number,
    createdAt?: number,
    text: string
}
```

## Create a question

<mark style="color:green;">`POST`</mark> `http://pollo-backend.cornellappdev.com/api/v2/sessions/:id/questions/`

#### Path Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
| id   | string | group id    |

#### Headers

| Name          | Type   | Description               |
| ------------- | ------ | ------------------------- |
| Authorization | string | `'Bearer ' + accessToken` |

#### Request Body

| Name | Type   | Description |
| ---- | ------ | ----------- |
| text | string |             |

{% tabs %}
{% tab title="200 " %}

```javascript
{
    success: true,
    data: <Question>
}
```

{% endtab %}
{% endtabs %}

## Get a question

<mark style="color:blue;">`GET`</mark> `http://pollo-backend.cornellappdev.com/api/v2/questions/:id/`

#### Path Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
| id   | string | question id |

#### Headers

| Name          | Type   | Description               |
| ------------- | ------ | ------------------------- |
| Authorization | string | `'Bearer ' + accessToken` |

{% tabs %}
{% tab title="200 " %}

```javascript
{
    success: true,
    data: <Question>
}
```

{% endtab %}
{% endtabs %}

## Get all questions for a group

<mark style="color:blue;">`GET`</mark> `http://pollo-backend.cornellappdev.com/api/v2/sessions/:id/questions/`

#### Path Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
| id   | string | group id    |

#### Headers

| Name          | Type   | Description               |
| ------------- | ------ | ------------------------- |
| Authorization | string | `'Bearer ' + accessToken` |

{% tabs %}
{% tab title="200 " %}

```javascript
{
    success: true,
    data: List<Question>
}
```

{% endtab %}
{% endtabs %}

## Get all questions for a group sorted by date (ascending)

<mark style="color:blue;">`GET`</mark> `http://pollo-backend.cornellappdev.com/api/v2/sessions/:id/questions/date/`

#### Path Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
| id   | string | group id    |

#### Headers

| Name          | Type   | Description               |
| ------------- | ------ | ------------------------- |
| Authorization | string | `'Bearer ' + accessToken` |

{% tabs %}
{% tab title="200 An array of objects with a date (Unix time) and the date's questions" %}

```javascript
{
  success: true,
  data: [
    {
      date: "1551846479",
      questions: [
        {
          id: string,
          text: string
        }
      ]
    }
  ]
}
```

{% endtab %}
{% endtabs %}

## Update a question

<mark style="color:orange;">`PUT`</mark> `http://pollo-backend.cornellappdev.com/api/v2/questions/:id/`

#### Path Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
| id   | string | question id |

#### Headers

| Name          | Type   | Description               |
| ------------- | ------ | ------------------------- |
| Authorization | string | `'Bearer ' + accessToken` |

#### Request Body

| Name | Type   | Description |
| ---- | ------ | ----------- |
| text | string |             |

{% tabs %}
{% tab title="200 The updated question" %}

```javascript
{
    success: true,
    data: <Question>
}
```

{% endtab %}
{% endtabs %}

## Delete a question

<mark style="color:red;">`DELETE`</mark> `http://pollo-backend.cornellappdev.com/api/v2/questions/:id/`

#### Path Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
| id   | string | question id |

#### Headers

| Name          | Type   | Description               |
| ------------- | ------ | ------------------------- |
| Authorization | string | `'Bearer ' + accessToken` |

{% tabs %}
{% tab title="200 " %}

```javascript
{
    success: true,
    data: null
}
```

{% endtab %}
{% endtabs %}

## Users

```
type User {
  id: number,
  name: string,
  netID: string
}
```

## Get me

<mark style="color:blue;">`GET`</mark> `http://pollo-backend.cornellappdev.com/api/v2/users/`

#### Headers

| Name          | Type   | Description               |
| ------------- | ------ | ------------------------- |
| Authorization | string | `'Bearer ' + accessToken` |

{% tabs %}
{% tab title="200 " %}

```javascript
{
    success: true,
    data: <User>
}
```

{% endtab %}
{% endtabs %}

## Authentication

```
type UserSession {
  accessToken: string,
  refreshToken: string,
  sessionExpiration: number,
  isActive: boolean
}
```

{% hint style="info" %}
If invalid `accessToken` is passed into request header, `401 error` is thrown.
{% endhint %}

## Authenticate mobile

<mark style="color:green;">`POST`</mark> `http://pollo-backend.cornellappdev.com/api/v2/auth/mobile`

#### Request Body

| Name    | Type   | Description |
| ------- | ------ | ----------- |
| idToken | string |             |

{% tabs %}
{% tab title="200 " %}

```javascript
{
    success: true,
    data: <UserSession>
}
```

{% endtab %}
{% endtabs %}

## Refresh session

<mark style="color:green;">`POST`</mark> `http://pollo-backend.cornellappdev.com/api/v2/auth/refresh/`

#### Headers

| Name          | Type   | Description                |
| ------------- | ------ | -------------------------- |
| Authorization | string | `'Bearer ' + refreshToken` |

{% tabs %}
{% tab title="200 " %}

```javascript
{
    success: true,
    data:<UserSession>
}
```

{% endtab %}
{% endtabs %}

## Socket Protocol

Built with Socket.io. [Documentation found here.](https://socket.io/docs/)

### Socket Connection

**Connect** (default socket) Make sure to visit `/join/session/` before joining a socket because this will create the socket if not created yet. You will need to emit `userType`  on connect to socket.\
\
**Disconnect** (default socket)

### Group

#### Rest

| Method | Body                               | URL               | Response                                                      | Description                 |
| ------ | ---------------------------------- | ----------------- | ------------------------------------------------------------- | --------------------------- |
| POST   | `code: string` and `name?: string` | `/start/session/` | `Group` - The group that was created, use `id` as a namespace | User sends to start a group |
| POST   | `id: number` or `code: string`     | `/join/session/`  | `Group`                                                       | User sends to join a group  |

### Socket

#### To Server

| Message                  | Body                                                          | Description                                              |
| ------------------------ | ------------------------------------------------------------- | -------------------------------------------------------- |
| `server/poll/start`      | `Poll` object without id                                      | Admin sends to start a poll                              |
| `server/poll/end`        | *empty*                                                       | Admin sends to stop a poll                               |
| `server/poll/results`    | *empty*                                                       | Admin sends to share results                             |
| `server/poll/tally`      | `Answer` object without id                                    | User sends to reveal their chosen response to the server |
| `server/poll/upvote`     | <p><code>{ answerID,</code></p><p><code>googleID }</code></p> | User sends to upvote an answer                           |
| `server/poll/delete`     | `pollID` \*same as db ID                                      | Admin sends to delete saved poll                         |
| `server/poll/deleteLive` | *empty*                                                       | Admin sends to delete live poll                          |

#### To Student

| Message                  | Body                                       | Description                                                                 |
| ------------------------ | ------------------------------------------ | --------------------------------------------------------------------------- |
| `user/poll/start`        | { poll: `Poll` object }                    | User receives to display a poll                                             |
| `user/poll/end`          | { poll: `Poll` object }                    | User receives when poll has ended                                           |
| `user/poll/results/`     | `CurrentState` object                      | User receives when if admin decides to share results                        |
| `user/poll/results/live` | `CurrentState` object                      | User receives when there is a live FR question when user first joins socket |
| `user/count`             | { count: `user count` }                    | User receives number of live users in socket                                |
| `user/poll/delete`       | `pollID` \*same as db ID                   | User receives when poll is deleted                                          |
| `user/poll/deleteLive`   | *empty*                                    | User receives when live poll is deleted                                     |
| `user/answer/success`    | *empty*                                    | User receives when FR answer is successfully registered (pass filter)       |
| `user/answer/filter`     | { text: `string`, filter: `string array` } | User receives when FR answer is *not*  registered (doesn't pass filter)     |

#### To Admin

| Message                  | Body                    | Description                                              |
| ------------------------ | ----------------------- | -------------------------------------------------------- |
| `admin/poll/start`       | { poll: `Poll` object } | Admin receives current poll upon entry (if there is one) |
| `admin/poll/updateTally` | `CurrentState` object   | Admin receives state of poll i.e. tallies                |
| `admin/poll/ended`       | { poll: `Poll` object } | Admin receives when poll has been ended                  |
| `user/count`             | { count: `user count` } | User receives number of live users in socket             |

### Type Definitions

{% hint style="info" %}
These objects are not saved outside of a socket.
{% endhint %}

#### Current State

```javascript
type CurrentState {
    poll: number,
    results: {},
    answers: {}, // google id to answer choice for MC and array of answer ids for FR
    upvotes: {}  // google id to array of answer ids
}
```

Example of results. Note: answers is a mapping of googleID to selected option.

```javascript
results = {'A': {'text': 'blue', 'count': 1}, 'B': {'text': 'red', 'count': 2}}

// FR example of answer id to answer
results = {1: {'text': 'blue', 'count': 0}, 2: {'text': 'red', 'count': 2}}
```

#### Answer

```javascript
type Answer {
    id: id,
    googleID: string,
    poll: id,
    choice: string,
    text: string
}
```

For MC: `choice` should be `C` and text should be `Saturn`.\
For FR: `choice` and `text` should be `Saturn`.

#### Poll

```javascript
type Poll {
    id: number, // id doesn't correspond to poll id when saved in db
    text: string,
    type: string,
    options: ?string[],
    shared: boolean,
    correctAnswer: string
}
```

`options` is the text of the choices. If the choices are

```
A) Blue B) Red C) Green D)
```

where `D` is a blank option, the choices would be:&#x20;

```javascript
options = ['Blue', 'Red', 'Green', '']
```

{% hint style="info" %}
`Poll` is saved into the database after admin ends poll.
{% endhint %}
