timy-messenger/firebase/functions/group-update.js
Franz Heinfling 64d39ac266 Initial commit.
Co-authored-by: Miguel Beltran <m@beltran.work>
2019-10-01 17:26:36 +02:00

15 lines
No EOL
463 B
JavaScript

const functions = require('firebase-functions');
const { updateCalendarGroupName } = require('./calendar-update');
const updatedGroup = functions
.region('europe-west1')
.firestore
.document('/groups/{groupId}')
.onUpdate(async (change, context) => {
const groupAfter = change.after.data();
// Update Calendar
await updateCalendarGroupName(context.params.groupId, groupAfter.name);
});
module.exports = updatedGroup;