gt-scheduler / website

Scheduling application designed to mitigate some of the pain-points present throughout Georgia Tech's registration process.
https://gt-scheduler.org
GNU Affero General Public License v3.0
87 stars 22 forks source link

[BoG S24] Improve getCourseDataFromCourseCritique Data Flow #301

Open yatharth-b opened 4 months ago

yatharth-b commented 4 months ago

Problem Description

GTS needs data from course critique to operate. This data is fetched with the following flow (image below). The cloud function currently caches the API data in firestore. However, this data in firestore can be accessible from the client if we update the firestore rules. This access from client side is also safe, since the course data is not private and is being accessed by all users anyway. This presents a possible optimization which can help us reduce our firebase costs by reducing function invocations by a big margin.

Old Flow

image

New Flow

image

The functioning of the cloud function remains the exact same, but we're changing how data is fetched on the client now (adding a new step to first check firestore after checking local storage before fetching data from the cloud function).

Note : run the firebase-conf repo locally and change the base url in the website repo to use local firebase functions. firebae-conf repo contains all the cloud functions - https://github.com/gt-scheduler/firebase-conf/tree/main

change url to localhost here - https://github.com/gt-scheduler/website/blob/ae9fbb6d0dc547659c34b589b45f194de757cb50/src/constants.ts#L79

Your Goal