We need to implement the functionality of exposing and ingesting listings. To do this we will need two functions that work together across Bloom instances.
How it will work:
- Externalize function will allow external versions of the site to access basic internal data with ids, names and for listings contentUpdatedAt
- Ingest function will allow the system to connect to an external version of the site through the export function and to pull in external listings
Externalize function (GET)
- Load data from the following source with the following data
- Jurisdictions - {id, name}
- Listings - {id, contentUpdatedAt, jurisdictionId}
- Reserved Community Types - {id, name}
- Unit Types - {id, name}
- Return in an object
Ingest function (PUT)
- Takes in
- target jurisdiction name,
- internal matching jurisdiction id,
- external api url
- Call external api GET export function endpoint
- Map the following:
- The target jurisdiction name to a jurisdiction in the returned list
- The returned reservedCommunityTypes to internal types
- If a reservedCommunityType cannot be matched, log error of missing RCT
- The returned unitTypes to internal types
- Load existing external listing ids and content_updated_at’s that match internal jurisdiction id and the returned external jurisdiction id
- Compare loaded listings to response (when creating/recreating, if the listing has a missing RCT, do not create and log warning)
- If listing is not in response, delete
- If listing is in response and has a newer content_updated_at, delete, call /listings/external/{id} and recreate
- If listing is in response and same content_updated_at, continue
- If new listing is in the response, create
We need to implement the functionality of exposing and ingesting listings. To do this we will need two functions that work together across Bloom instances.
How it will work:
Externalize function (GET)
Ingest function (PUT)