Skip to content

Commit

Permalink
functions setup
Browse files Browse the repository at this point in the history
  • Loading branch information
IdanCo committed Mar 24, 2019
1 parent 7f00f6e commit 67bb460
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion functions/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,29 @@
import * as functions from 'firebase-functions';
// import * as functions from 'firebase-functions';

// const admin = require('firebase-admin');
// admin.initializeApp();

// // Start writing Firebase Functions
// // https://firebase.google.com/docs/functions/typescript
//
// export const helloWorld = functions.https.onRequest((request, response) => {
// response.send("Hello from Firebase!");
// });

// export const updateVotes = functions.firestore
// .document('candidates/{candidateId}')
// .onUpdate((change, context) => {
// const candidate = change.after!.data();
//
// // no need to updates votes if there are no votes
// if (!candidate || !candidate.votes) return;
//
// let totalVotes = 0;
//
// Object.keys(candidate.votes).forEach(voter => {
// totalVotes += candidate.votes[voter];
// });
//
// change.after.ref.update({ totalVotes });
//
// });

0 comments on commit 67bb460

Please sign in to comment.