in backend/index.ts [227:241]
function addOrUpdateFirestore(product) {
firestore
.collection("inventory")
.where("name", "==", product.name)
.get()
.then((querySnapshot) => {
if (querySnapshot.empty) {
firestore.collection("inventory").add(product);
} else {
querySnapshot.forEach((doc) => {
firestore.collection("inventory").doc(doc.id).update(product);
});
}
});
}