Skip to content

Fetch Data with Foursquare

sosc7662 requested to merge search-with-fsq into main

Search Page

We now fetch Places from our Database and from Foursquare depending on our location. When places appear in both, the place stored in the database will be prefered.

Place Details

When clicking on a Place in the list, the following aspects are checked:

  1. Is the Place in our database? No: Fetch it from FSQ and store it in the database Yes: Fetch it from the Database
  2. Is the Place from the Database expired? No: Return it Yes: Fetch it from FSQ and store it in the database

In the case of creating or updating a Place from FSQ, the expiration date will be updated to be 24h in the future.

Fields

Foursquare gives us access to many fields that we want to use to the fullest. Most are simple primitive Datavalues but others require some more work:

Features:

Foursquare devides the features of a place into different sections. In order to reduce complexity we don't store them in sections but just the features as a full list. A feature can either be a String value or a Boolean value. We will need to handle the displaying of each feature in the frontend.

Hours:

Hours contain the regular hours provided by foursquare. We rebuild them (since they have a horrible structure for our usecase) as a Map where the key is the day (0-6) and the value includes the opening and the closing time. However, not all places provide regular hours, wherefore we also need the following field:

Display Hours:

This is just a String that seems to follow no real structure. But more places provide this than having regular hours so we use this as a fallback in the frontend (we need to figure out a way to style it tho)

Photos:

Photos are provided as a list of objects from fsq which enables the construction of an url to access the image. I simplified it by constructing the url on fetch and determining a fixed size for the photos. The result is a list of urls to images for the place that can be set as the image uri in the frontend.

Socials

The Social Links to the places are displayed as icons on the details page. By clicking on them a browser is opened and the website to the profile is opened. For Facebook one might need to login before seeing the page

Merge request reports

Loading