> For the complete documentation index, see [llms.txt](https://docs.airdev.co/rental-marketplace-template/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.airdev.co/rental-marketplace-template/general-information/data-structure.md).

# Data Structure

The database structure for the template

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 %}

## 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

## Blocked Date

This data type represents a date range for which a particular `Listing` is unavailable for booking. A `Blocked Date` is created each time a listing owner adds an unavailability date (or dates) to their listing **or** a user books that listing.

| Field name     | Type        | Description                                                                                                                                                                                                                                           |
| -------------- | ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Booking        | Booking     | The `Booking instance` that this `Blocked Date` is associated with. A single `Blocked Date` is created each time a `Booking` is created. This field will be empty if this `Blocked Date` was added from the dashboard                                 |
| Dates (list)   | date (list) | A list of dates spanning from the beginning of the `Blocked Date` to the end. This list includes each date from the `Start` to `End (actual)` (inclusive). This is used to tell the datepicker on the listing page which dates the user cannot select |
| End            | date        | The end of a `Blocked Date`                                                                                                                                                                                                                           |
| End (actual)   | date        | The end of a `Blocked Date` minus one day. This represents the actual last date that is functionally blocked by the `Blocked Date`                                                                                                                    |
| Listing        | Listing     | The `Listing` instance that this `Blocked Date` is associated with. Unlike the `Booking` field, this field should always be populated                                                                                                                 |
| Owner created? | yes / no    | Indicates whether this `Blocked Date` was created manually by the listing owner. `Blocked Dates` created from the dashboard page will have this field set to **yes**. Those created through the booking flow will have this set to **no**             |
| Range          | date range  | A date range spanning from the `Start` to the `End (actual)`. The range represents the span of the `Blocked Date`, **non-inclusive** of the `End date`                                                                                                |
| Start          | date        | The beginning of a `Blocked Date`                                                                                                                                                                                                                     |

## Booking

This data type represents a single instance of one user booking another user’s listing. A `Booking` is created when a user confirms a booking start date, end date, and price and successfully processes a payment using their card on file.

| Field name                    | Type         | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| ----------------------------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| API workflow ID: review email | text         | The ID of the API workflow used to send an email to the booked user after the booking. This is used to cancel this API workflow when the booking is cancelled                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| Blocked date                  | Blocked Date | The `Blocked Date` that is associated with this booking. A single `Blocked Date` is created for each booking, and has the same date range as the booking                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| Booked user                   | User         | The user who initiated and paid for the booking                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| Cancelled?                    | yes / no     | Indicates whether the booking has been cancelled. Cancelled bookings will have this field set to **yes**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| Charge ID                     | text         | The ID of the payment processed for the `Transaction` from this booking. This value is returned from **Stripe** and corresponds with a particular payment in your Stripe dashboard                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| End date                      | date         | The end date of the booking. This is essentially the checkout date for the booking. When determining the price of the booking, the calculation is not inclusive of the end date                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| Fee charged                   | number       | <p>The amount (in US dollars) of the booking’s Transaction which was sent to the application owner (i.e., the person/entity who owns the primary Stripe account for the app). This amount is included in the <code>Total amount charged</code>. This is calculated by multiplying the booking <code>Price</code> by the <strong>App fee / 100</strong> (<strong>app fee</strong> is an integer amount ranging from 0 to 100, and is stored on the <code>Website</code> object)</p><p><br><strong>Example:</strong> Booking price is <strong>$100</strong> (app fee is <strong>20%</strong>) → $100 \* (20 / 100) = <strong>$20</strong></p> |
| Listing                       | Listing      | The `Listing` that this booking is associated with. This is the property that the `Booked user` has booked for the booking duration                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| Listing owner                 | User         | The owner of the `Listing` for this booking                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| Notes                         | text         | Additional meta-data for the booking. This currently has no functional purpose in the application                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| Paid?                         | yes / no     | Indicates whether the booking has been paid for by the `Booked user`. This field is set to **yes** if/when the `Booked user` successfully processes a payment for this booking. All `Bookings` in the app should have this field set to **yes**, as `Bookings` with unsuccessful payments are automatically deleted                                                                                                                                                                                                                                                                                                                         |
| Price                         | number       | <p>The price that the <code>Booked User</code> pays when creating the booking. This is calculated by taking the number of days for the booking duration (not inclusive of the end date) and multiplying it by the booking’s <code>Listing’</code>s price</p><p></p><p><strong>Example:</strong> Dec. 1 to Dec. 5 (price <strong>$25</strong> per night) → (5 - 1) \* $25 = <strong>$100</strong></p>                                                                                                                                                                                                                                        |
| Review                        | Review       | The `Review` associated with this booking. There can be up to **one** `Review` per booking. This is populated if the `Booked user` submits a review following completion of the booking duration                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| Start date                    | date         | The beginning date of the booking                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| Total amount charged          | number       | <p>The overall amount (in US dollars) that was charged in this booking’s <code>Transaction</code>. This number should be equivalent to the <strong>sum</strong> of the <code>Price</code> field and <code>Fee charged</code> field</p><p></p><p><strong>Example:</strong> Price is <strong>$100</strong> (fee is <strong>$20</strong>) → $100 + $20 = <strong>$120</strong></p>                                                                                                                                                                                                                                                             |
| Total amount charged (Stripe) | number       | The overall amount (in US **cents**) that was charged in this booking’s `Transaction`. This should be equivalent to the `Total amount charged` multiplied by 100 (so essentially the total charge amount converted to cents). This value is returned from **Stripe** and populated following a successful payment for the booking. This field exists primarily for reference purposes                                                                                                                                                                                                                                                       |
| Transaction                   | Transaction  | The `Transaction` associated with this booking. There is **one** `Transaction` per booking, which is created following a successful payment                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |

## 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.

## Flag

This data type is created each time a user chooses to flag (i.e., report) a listing. This may or may not include a message. Only admin accounts can view flags.

| Field name | Type     | Description                                                                                                                                                                       |
| ---------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Dismissed? | yes / no | Indicates whether or not this `Flag` has been reviewed by an admin. `Flags` with their `Dismissed?` field set to **yes** are not shown in the list of flags in the owner’s portal |
| Listing    | Listing  | The `Listing` that the user has flagged                                                                                                                                           |
| Reason     | text     | The explanation for flagging the listing. This is viewable to admins in the owner’s portal                                                                                        |
| User       | User     | The creator of the `Flag` and author of the message (if included)                                                                                                                 |

## 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.

## Image

This data type represents a single image that is associated with a particular `Listing`. This image may be a primary image or standard image for a listin&#x67;**.**

| **Field name** | Type    | Description                                                |
| -------------- | ------- | ---------------------------------------------------------- |
| Image          | image   | The actual image for this `Image` instance                 |
| Listing        | Listing | The `Listing` that this image was added for and represents |

## Listing

This data type represents a listing that users can search for and book on the platform. A `Listing` is created from the dashboard after a user registers as a seller and connects their Stripe account. A `Listing` is comprised of property details and information that impacts how users can interact with the listing.

| Field name                        | Type                | Description                                                                                                                                                                                                                                                                                                                                     |
| --------------------------------- | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Blocked dates                     | Blocked Date (list) | The list of `Blocked dates` for this listing. This list should include one `Blocked date` per `Booking` for this listing as well each `Blocked date` created by the `Owner` from the dashboard                                                                                                                                                  |
| Bookings                          | Booking (list)      | The list of `Bookings` for this listing. This list should include all Bookings made for this listing, including past, current, and cancelled `Bookings`                                                                                                                                                                                         |
| Cancellation policy (days before) | number              | The number of days before a `Booking`’s start date that the cancellation option becomes unavailable. In other words, a `Booking`’s `Booked user` can cancel the booking from the booking creation time **up to** this amount of days before the booking starts. This field is only relevant if `Cancellation policy include?` Is set to **yes** |
| Cancellation policy include?      | yes / no            | Indicates whether the listing allows users who have booked it to cancel the `Booking`. If this is set to **no**, the cancellation option will not be available                                                                                                                                                                                  |
| Description                       | text                | The description for the listing displayed on the public listing page. This is populated by the listing `Owner` from the dashboard                                                                                                                                                                                                               |
| Image main                        | Image               | The primary image for the listing. This is used on the search and dashboard pages for the displayed list of listings. When the public listing page for this listing is loaded, this will be the image displayed at the top                                                                                                                      |
| Images                            | Image (list)        | The secondary images for the listing. These are shown only on the listing page and can be enlarged from that page. This list does **not** include `Image main`                                                                                                                                                                                  |
| Inactive\_admin?                  | yes / no            | Indicates if the listing has been deactivated by an app admin. Deactivated listings do not appear on the search page and cannot be booked by users                                                                                                                                                                                              |
| Inactive\_user?                   | yes / no            | Indicates if the listing has been deactivated by the listing owner. Deactivated listings do not appear on the search page and cannot be booked by users                                                                                                                                                                                         |
| Location                          | geographic address  | The geographical address for the listing. The application requires users to enter a valid address including a street number. Users only see the city and state on the search page and will be given the full address after a successful booking                                                                                                 |
| Owner                             | User                | The owner and creator of the listing                                                                                                                                                                                                                                                                                                            |
| Price                             | number              | The per day rental price of the listing in US dollars. This is used when an overall booking cost is calculated                                                                                                                                                                                                                                  |
| Rating                            | number              | The numeric average of every `Rating` created for this listing. This number has a minimum of 0 and a maximum of 5                                                                                                                                                                                                                               |
| Reviews                           | Review (list)       | The list of `Reviews` created for this listing                                                                                                                                                                                                                                                                                                  |
| Title                             | text                | The title of the listing                                                                                                                                                                                                                                                                                                                        |

## Message

This data type represents a single message within a message thread. A `Message` is created each time a user sends a message in the chat module.

| Field name      | Type        | Description                                                                                                                                                             |
| --------------- | ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Attachment      | file        | The file that the message author has attached to the message. This is optional                                                                                          |
| Text            | text        | The content of the message                                                                                                                                              |
| Thread          | Thread      | The overall message thread that this message is associated with. A `Message` will always have **one** `Thread`                                                          |
| Users           | User (list) | The list of users who are involved with this message’s `Thread`. This field is used for setting privacy rules. In this app, this field should always have **two** users |
| Viewed by users | User (list) | The list of users who have viewed this message in the chat module. This allows you to determine which messages are unread                                               |

## 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.

## Review

This data type represents a user-written review for a given listing. A `Review` is created when a user submits a review from their dashboard following a booking’s end date.

| Field name | Type    | Description                                                                                                          |
| ---------- | ------- | -------------------------------------------------------------------------------------------------------------------- |
| Author     | User    | The creator and author of this review. This user can only review a listing that they have booked (and not cancelled) |
| Booking    | Booking | The `Booking` that this review is associated with. A user can create **one** `Review` per booking                    |
| Listing    | Listing | The `Listing` that this review is associated with. This `Review` will be shown at the bottom of this listing’s page  |
| Rating     | number  | The numeric rating that the user has selected for this review. This can range from **1 to 5**                        |
| Text       | Title   | The description/explanation for this review                                                                          |
| Title      | text    | The title of this review                                                                                             |

## Thread

This data type represents a message thread between two users. All messages sent within this thread are linked to this thread.

| Field name    | Type        | Description                                                                                                                         |
| ------------- | ----------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| Inactive?     | yes / no    | Indicates whether the message thread is active and viewable                                                                         |
| Last msg sent | date        | The date and time of the most recently created message for this thread                                                              |
| Users         | User (list) | The list of users who are involved with and have access to this thread. In this app, this field should always contain **two** users |

## Transaction

This data type represents a single transaction involving one user processing a payment sent to another user. A `Transaction` is created each time a user books a listing and successfully processes a payment to another user.

| Field name                    | Type    | Description                                                                                                                                                                                                                                                                         |
| ----------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Booking                       | Booking | The `Booking` that this `Transaction` is associated with. There should always be **one** `Transaction` per `Booking`                                                                                                                                                                |
| Charge ID                     | text    | The ID of the payment processed for this transaction. This value is returned from **Stripe** and corresponds with a particular payment in your Stripe dashboard                                                                                                                     |
| Charged user                  | User    | The user whose credit card (and Stripe account) was charged for this transaction                                                                                                                                                                                                    |
| Fee charged                   | number  | The amount (in US dollars) of the transaction which was sent to the application owner (i.e., the person/entity who owns the primary Stripe account for the app). This amount is included in the `Total amount charged`. This value is pulled directly from the associated `Booking` |
| Listing                       | Listing | The `Listing` associated with this `Transaction`                                                                                                                                                                                                                                    |
| Recipient                     | User    | The user who received the amount processed in this `Transaction`                                                                                                                                                                                                                    |
| Total amount charged          | number  | The overall amount (in US dollars) that was charged in this transaction. This value is pulled directly from the associated `Booking`                                                                                                                                                |
| Total amount charged (Stripe) | number  | The overall amount (in US **cents**) that was charged in this transaction. This is value is pulled directly from the associated `Booking`. This field exists primarily for reference purposes                                                                                       |

## 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.                                                                                  |
