1. Home
  2. Docs
  3. Classifieds App – Documentation
  4. Setting up Firebase Tables

Setting up Firebase Tables

1. Firestore Table Names

The name of the Firestore tables can be found in ClassifiedsApp/ClassifiedsSettingsProvider.swift class:

    var referenceListingsTableName: String {
        return "classifieds_listings"
    }

    var referenceReviewsTableName: String {
        return "classifieds_reviews"
    }

    var referenceCategoriesTableName: String {
        return "classifieds_categories"
    }

    var referenceFiltersTableName: String {
        return "classifieds_filters"
    }

You can rename these tables as you wish.

There are tables that get populated automatically (reviews, listings) and tables that you need to populate upfront (categories and filters). Let’s see how we can populate the ones that are mandatory.

2. Table Structures

In order for the app to correctly display your data, you need to add your data into the correct Firebase tables, with precise field names. Here’s how all these fields look like:

classifieds_filters

Filters are characteristics of the listings. They have a name, an id and a list of options. Each listing can have multiple filters, and to each (listing, filter) pair there’s only a single option.

For example, listing X can have two filters: one named “Price” with the value “$$”, and one named “Cuisine” with the value “French”.

So add all your filters first, by providing id, name and options fields:

The mapping of these fields can be found in code in Core/Filters/Models/ATCSelectFilters.swift

classifieds_categories

Listings are classified in categories, so let’s add your categories. These show up in different places in the app, such as:

  • on home page, as the top horizontal scroll unit
  • on the categories screen

For each category, please specify id, title, photo (which is a valid URL):

To rename or change these fields, you can find the mapping in code at Core/Listings/Models/ATCListingCategory.swift.

classifieds_listings

These are the actual listings that users can browse in the app. They belong to one category and can have multiple filters.

It’s highly recommended that you add these listings directly from the app, so that you don’t need to specify the coordinates, filters, author, etc. manually. Simply add a listing and then check out the result in Firestore, which should look like this:

You can find the full list of fields in the corresponding model, which resides in Core/Listings/Models/ATCListing.swift

Once done, you’ll be able to see all of your categories, filters and listings in the app. Play around with the app to make sure everything works perfectly.