WorldHealthOrganization / app

COVID-19 App

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

v2 backend: remove or replace `putClientSettings` endpoint

rjhuijsman opened this issue · comments

Summary

Currently, the putClientSettings endpoint that's part of the v1 API is available in the v2 backend as a HTTPS Cloud Function. However, that doesn't track with how we'd like to client-backend interaction; we'd like to move towards direct use of Firestore by the client, without a custom API layer in between.

In addition, the FCM token being updated through this call (its reason for existing) isn't currently being used - we should discuss the future of this functionality.

Desired Solution

We'd like to:

  1. Discuss whether the FCM token logic has a reason to exist in the project, or whether we should remove this functionality entirely. If the FCM token won't have a use at all, we should remove this functionality instead of doing the things below. If the FCM token does have a use...
  2. Replace the putClientSettings API with direct Firestore access.
  3. Implement the clientSettingsUpdated Cloud Function with the logic to use the FCM token as desired.

Additional Context

Cloud Functions live in app/server/functions/src/index.ts.

To allow for direct access to Firestore, we will need to update our firestore.rules. Please also update the unit tests in firestore_rules.spec.ts to show what clients should and should not be allowed to do under the new rules.