{"size": 1128, "ext": "js", "max_stars_repo_path": "waiverRejector.js", "max_stars_repo_name": "hyphen-hacks/dashboard-backend", "max_stars_repo_stars_event_min_datetime": "2020-05-05T18:45:04.000Z", "max_stars_repo_stars_event_max_datetime": "2020-05-05T18:45:04.000Z", "max_issues_repo_path": "waiverRejector.js", "max_issues_repo_name": "hyphen-hacks/dashboard-backend", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "waiverRejector.js", "max_forks_repo_name": "hyphen-hacks/dashboard-backend", "max_forks_repo_forks_event_min_datetime": "2019-05-21T18:29:03.000Z", "max_forks_repo_forks_event_max_datetime": "2019-05-21T18:29:03.000Z"}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 26.8571428571, "max_line_length": 67, "alphanum_fraction": 0.6764184397}
const keys = require('./private/api-keys.json')
const admin = require("firebase-admin");
const fetch = require('node-fetch');
const fs = require('fs')
const moment = require('moment')
const endPoint = 'https://api.sendgrid.com/v3/contactdb/recipients'
let requestBody = []
let emails = []

admin.initializeApp({
  credential: admin.credential.cert(keys.firebase),
  databaseURL: "https://hyphen-hacks-2019.firebaseio.com"
});

function Person(input) {
  this.email = input.email
  this.name = input.name
  this.referrer = 'hyphen-hacks_2019'
  this.years_involved = '2019'
  this.waiver_completed = 'false'
  if (input.ticket_class_name === 'High school Student') {
    this.role = 'attendee'
  } else {
    this.role = 'mentor'
  }
}

const db = admin.firestore();
const peopleRef = db.collection('people');
const queryRef = peopleRef.where('waiverStatus', '<', 2);
let counter = 0;
peopleRef.get().then(data => {
  data.forEach(snap => {
    const person = snap.data()
    if (person.waiverStatus === 2) {
      counter ++
      peopleRef.doc(person.id).update({waiverStatus: 0})
    }

  })
})
console.log('updated', counter)