# Data Structure

All objects and some selected fields in the template are explained below. Please refer to our [Bubble Best Practices](https://docs.airdev.co/bubble-development-guide/steps/plan/database-structure) document for guidance on how the Bubble database should be structured.

{% hint style="warning" %}
All data types and a few select fields are explained below. A good general rule to follow is that you shouldn't delete any fields that are included with the template and instead only add new ones.
{% endhint %}

## Answer

This data type represents an answer given for an application question. An `Answer` is created when a `Applicant` responds to a question from the `Form` for the `Job` they are applying to. The `Answer` object has several different fields for representing its value. Only one of these fields is relevant for an `Answer` (the `Type` field indicates which value field to reference).

| Field name              | Type           | Description                                                                                                                                                                              |
| ----------------------- | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Applicant               | Applicant      | The `Applicant` - or application - associated with this answer                                                                                                                           |
| Form field              | Form field     | The `Form field` - or question - associated with this answer. An `Answer` is always linked to a `Form field`                                                                             |
| Order                   | number         | This is equivalent to this answer's `Form field`'s `Order`. It is used for identifying the first or first couple `Answers` for an application                                            |
| Type                    | text           | The type of question / value this answer was created for. This value will be either **Short text**, **Number**, **Long text**, **Multiple choice**, **Checkboxes**, or **File uploader** |
| Value - checkboxes      | Options (list) | The output / value of this answer if its `Type` is **Checkboxes**                                                                                                                        |
| Value - file uploader   | file           | The output / value of this answer if its `Type` is **File uploader**                                                                                                                     |
| Value - long text       | text           | The output / value of this answer if its `Type` is **Long text**                                                                                                                         |
| Value - multiple choice | text           | The output / value of this answer if its `Type` is **Multiple choice**                                                                                                                   |
| Value - number          | number         | The output / value of this answer if its `Type` is **Number**                                                                                                                            |
| Value - short text      | text           | The output / value of this answer if its `Type` is **Short text**                                                                                                                        |

## Applicant

This data type represents an instance of an application being submitted for a `Job`. An `Applicant` is associated with an individual, a status (using the `Stage` data type), and a list of `Answers`. It is linked to whatever `Form` was associated with the relevant `Job` at the time the application was created. **Admins** and **Managers** can view all `Applicants` and **Viewers** can view any `Applicants` for `Jobs` which they are assigned.

| Field name | Type           | Description                                                                                                                                      |
| ---------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| Answers    | Answers (list) | The list of `Answers` for this applicant. All `Answers` in this list will have their `Applicant` field set to this applicant                     |
| Form       | Form           | The application `Form` associated with this `Applicant`. This is equivalent to the `Form` of this applicant's `Job` at the time it was submitted |
| Job        | Job            | The `Job` this application was submitted for                                                                                                     |
| Saved?     | yes / no       | Indicates whether the application has been submitted. Only applicants with `Saved?` set to **yes** will be viewable on the platform              |
| Stage      | Stage          | The current `Stage` - or status - of this applicant                                                                                              |

## Block entry

This data type is used to store content that goes into each homepage block. Each homepage block (template) will have a maximum number of block entries:

* Testimonials section: Multiple entries
* Featured section: Up to 3 entries
* Process section: Up to 3 entries
* Slideshow section: Between 3 to 5 entries
* Capabilities section: Up to 9 entries
* Video section: 1 entry
* Press section: Between 3 to 5 entries
* About section: 1 entry
* Call-to-action section: 1 entry
* Contact section: 0 entries

## Dummy

This data type allows you to quickly preview your page layout by it as your data source.

## Feature backlog

This data type represents each feature that an Owner has added into the Backlog section of the Owner's Portal.

## Form

This data type represents an application form for a `Job`. Any number of `Forms` can be added to the platform (and modified). A `Form` can be assigned to any number of `Jobs`. The majority of a `Form`'s content is stored through its list of `Form fields`.

| Field name           | Type              | Description                                                                                                                                                                                        |
| -------------------- | ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Confirmation message | text              | The message shown to users after they submit a job application with this form                                                                                                                      |
| Form fields          | Form field (list) | The list of `Form fields` - or questions - for this form / application                                                                                                                             |
| Inactive?            | yes / no          | Indicates whether this form can be assigned to `Jobs` and used on the platform. Deleted forms have their `Inactive?` set to **yes** and are only used for viewing past `Applicants` with this form |
| Name                 | text              | The name and primary identifier for the form                                                                                                                                                       |
| Saved?               | yes / no          | Indicates whether the form has been saved. All created forms should have this field set to **yes**                                                                                                 |

## Form field

This data type represents a single question for an application form for a `Job`. Each `Form Field` is associated with exactly **one** `Form`. A `Form Field` can be one of several different types - text, number, file, etc. - which will determine which type of input the user is shown when answering this question.&#x20;

| Field name | Type          | Description                                                                                                                                                                                                                                      |
| ---------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Form       | Form          | The `Form` - or application - this form field is associated with                                                                                                                                                                                 |
| Inactive?  | yes / no      | Indicates whether this form field is active and shown on the application. Deleted form fields have their `Inactive?` set to **yes**                                                                                                              |
| Options    | Option (list) | The list of `Options` for this form field. `Options` are used if this question's `Type` is **Multiple choice** or **Checkboxes**                                                                                                                 |
| Order      | number        | The order that this question appears on the `Form`                                                                                                                                                                                               |
| Prompt     | text          | The label / prompt shown for this question                                                                                                                                                                                                       |
| Required?  | yes / no      | Indicates whether this question must be answered for the application / `Form` to be submitted                                                                                                                                                    |
| Type       | text          | The type for this question. This determines what type of input is shown to the user when answering this question. This value will be either **Short text**, **Number**, **Long text**, **Multiple choice**, **Checkboxes**, or **File uploader** |

## Homepage block template

The data type is used for the homepage maker. App owners can add any number of homepage blocks / homepage sections straight from the owner's portal by starting from a homepage block template.

## Homepage block

App Owners can add an unlimited number of homepage blocks. They can control the content and settings from the Owner's Portal.

## Job

The data type represents a job on the platform that users can view and submit and application for. **Admins** and **Managers** can create, modify, and delete all `Jobs` while **Viewers** can see only `Jobs` which they are assigned.&#x20;

| Field name       | Type               | Description                                                                                                                                                                                                                                                                                         |
| ---------------- | ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Application form | Form               | The application - or `Form` - that users will fill out when applying for this job                                                                                                                                                                                                                   |
| Assigned users   | User (list)        | The list of `Users` assigned to this job. **Admins** and **Managers** can assign any other user types to a job. **Viewers** can only interact with jobs whose `Assigned users` contains their user account. All `Assigned users` will receive an email when an application for the job is submitted |
| Description      | text               | The description shown for the job                                                                                                                                                                                                                                                                   |
| Inactive?        | yes / no           | Indicates whether the job is active on the platform. Only jobs whose `Inactive?` is **no** are viewable on the [homepage](https://docs.airdev.co/applications-platform-template-reference/assets/pages/home-page) and open for applications                                                         |
| Location         | geographic address | The geographic address shown for this job                                                                                                                                                                                                                                                           |
| Saved?           | yes / no           | Indicates whether the job has been saved. Only jobs whose `Saved?` field is set to **yes** will be shown throughout the platform                                                                                                                                                                    |
| Title            | text               | The name and primary identifier for the job                                                                                                                                                                                                                                                         |
| Type             | text               | The type for the job. This value should be either **Full-time** or **Part-time**                                                                                                                                                                                                                    |

## Note

This data type represents a note - or comment - for a given `Applicant`. A `Note` may contain text or a file attachment (and will always have one or the other).

| Field name | Type      | Description                                                                             |
| ---------- | --------- | --------------------------------------------------------------------------------------- |
| Applicant  | Applicant | The `Applicant` this note was created for. This field should be populated for all notes |
| Attachment | file      | The file attachment for this note                                                       |
| Text       | text      | The text content for this note                                                          |

## Option

This data type represents a single option that can be chosen for a question (`Form Field`) on an application. Any `Form Field` whose `Type` field is **Multiple choice** or **Checkboxes** should have **at least two** `Options`. An applicant selects from these `Options` when creating an `Answer` for this type of `Form Field` / question.

| Field name | Type       | Description                                                     |
| ---------- | ---------- | --------------------------------------------------------------- |
| Form field | Form field | The `Form field` - or question - this option is associated with |
| Label      | text       | The label for this option                                       |
| Order      | number     | The order this option appears in lists                          |

## Palette color

This data type is color palette list is referenced in the Air Color Picker plugin / element. Feel free to add more color entries for quick access when using the Air Color Picker element.

## Push token

This represents a unique token to be used with **OneSignal** for push notification integrations for wrapped mobile apps.

## Role

The role and permissions level assigned to a user account. Each `User` should have exactly **one** `Role`. A `User`'s `Role` determines which `Jobs` they can view and interact with on the [dashboard](https://docs.airdev.co/applications-platform-template-reference/assets/pages/dashboard). The three types of `Roles` are **Admin**, **Manager**, and **Viewer**.

| Field name    | Type     | Description                                                                                                                                                                                                                                                                     |
| ------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Can view all? | yes / no | Indicates whether the user can view and interact with all `Jobs` on the platform or only assigned `Jobs`. It also determines if the user can create and view `Forms` on the [dashboard](https://docs.airdev.co/applications-platform-template-reference/assets/pages/dashboard) |
| Type          | text     | The label for this role. This value should be either **Admin**, **Manager**, or **Viewer**                                                                                                                                                                                      |

## Stage

This data type represents the current `Stage` - or status - of an `Applicant`. An `Applicant`'s `Stage` can be updated any time after the application is submitted and is used primarily for reference purposes. `Stages` are created and managed from the [owner's portal](https://docs.airdev.co/applications-platform-template-reference/assets/pages/owners-portal-page).

| Field name | Type   | Description                                    |
| ---------- | ------ | ---------------------------------------------- |
| Name       | text   | The name and primary identifier for this stage |
| Order      | number | The order that this stage will appear in lists |

## User

The user data type represents each person who has an account in your application.

| Field name                            | Type     | Description                                                                              |
| ------------------------------------- | -------- | ---------------------------------------------------------------------------------------- |
| Date agreed to terms and privacy docs | date     | Date agreed to terms and privacy docs during sign up                                     |
| Inactive                              | yes / no | User is marked as inactive = yes when App owner deletes the user from the Owner's Portal |
| Last login                            | date     | Captures the last date that the user loaded any page in the app                          |
| Owner?                                | yes / no | If Owner is yes then they will have access to the Owner's Portal                         |
| Signup method                         | text     | E.g., E-mail, LinkedIn, Facebook, Twitter, or etc.                                       |

## Website

This data type includes fields for all app-wide settings. Most of the data fields are controlled by the App Owner from the Owner's portal. There should only be a single object of this data type.

| Field name       | Type                    | Description                                                                                                                                                                               |
| ---------------- | ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Ask for cookies? | yes / no                | App Owner can control whether or not to ask users to accept cookies (if yes, a cookies banner will show on the homepage)                                                                  |
| Email            | text                    | Contact / support email that all emails in the application come from. Whenever a new email action is created in the application, it should refer to this field instead of being hardcoded |
| Email HTML       | text                    | Used in the [SendGrid API call for "send emails"](https://docs.airdev.co/canvas/quickstart-guide#step-2-setting-up-your-email) that generates a nicely-formatted HTML email               |
| List of blocks   | List of homepage blocks | Homepage blocks / sections                                                                                                                                                                |
| Name             | text                    | Name of your app / website. This is the field that should be referenced anywhere where the name is used (instead of hardcoded).                                                           |
| Primary color    | text                    | App and email template primary color                                                                                                                                                      |
| Usersnap off?    | yes / no                | This turns off the Usersnap tool, which AirDev uses with its clients to submit feedback and bug reports.                                                                                  |
