|
3 | 3 | Since MongoDB has no set schema, we document it here to document what our objects should look like. If you add new properties or remove them from objects **make sure to update them here**.
|
4 | 4 |
|
5 | 5 | In this document:
|
6 |
| -- [Form structure](#form-structure) |
| 6 | +- [Form](#form) |
7 | 7 | - [Form features](#form-features)
|
8 | 8 | - [Form question](#form-question)
|
| 9 | +- [Form response](#form-response) |
| 10 | + - [User details object](#user-details-object) |
| 11 | + - [Anti-spam object](#anti-spam-object) |
9 | 12 |
|
10 |
| -## Form structure |
| 13 | +## Form |
11 | 14 |
|
12 | 15 | | Field | Type | Description | Example |
|
13 | 16 | | ----------- | ---------------------------------------- | ----------------------------------------------------------------------------------------- | --------------------------- |
|
@@ -120,3 +123,28 @@ Textareas require no additional configuration.
|
120 | 123 | "text": "This section will quiz you on A, B and C"
|
121 | 124 | }
|
122 | 125 | ```
|
| 126 | + |
| 127 | +## Form response |
| 128 | + |
| 129 | +| Field | Type | Description | |
| 130 | +| ---------- | ---------------------------------------------------- | --------------------------------------------------------------------------- | |
| 131 | +| `_id`/`id` | MongoDB ObjectID | Random identifier used for the response | |
| 132 | +| `user` | Optional [user details object](#user-details-object) | An object describing the user that submitted if the form is not anonymous | |
| 133 | +| `antispam` | Optional [anti spam object](#anti-spam-object) | An object containing information about the anti-spam on the form submission | |
| 134 | +| `response` | Object | Object containing question IDs mapping to the users answer | |
| 135 | +| `form_id` | String | ID of the form that the user is submitting to | |
| 136 | + |
| 137 | +### User details object |
| 138 | + |
| 139 | +The user details contains the information returned by Discord alongside an `admin` boolean key representing that the user has admin privileges. The information returned from Discord can be found in the [Discord Developer portal](https://discord.com/developers/docs/resources/user#user-object). |
| 140 | + |
| 141 | +### Anti-spam object |
| 142 | + |
| 143 | +The anti-spam object contains information about the source of the form submission. |
| 144 | + |
| 145 | +| Field | Type | Description | |
| 146 | +| ----------------- | ------- | ----------------------------------------------- | |
| 147 | +| `ip_hash` | String | hash of the submitting users IP address | |
| 148 | +| `user_agent_hash` | String | hash of the submitting users user agent | |
| 149 | +| `captcha_pass` | Boolean | Whether the user passsed the hCaptcha | |
| 150 | +| `dns_blacklisted` | Boolean | Whether the submitting IP is on a DNS blacklist | |
0 commit comments