Compare commits

...
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

2 Commits

Author SHA1 Message Date
Atridad Lahiji 1f6b2e8332 Still some kinks to work out 1 year ago
Atridad Lahiji 0582e8338a Initial changes 1 year ago
  1. 94
      backend/db.js
  2. 1
      components/dialog/EditPollDialog.vue
  3. 2
      components/workflow/HomeScreen.vue
  4. 180
      functions/api.js
  5. 163
      package-lock.json
  6. 1
      package.json
  7. 8
      plugins/firebase/firebase.js

94
backend/db.js

@ -16,15 +16,15 @@ import firebase from '@firebase/app'
const fetchQuestions = function (context) {
// Define a database reference for user questions based on a specific pollid and creates a Firebase watcher
const qRef = firebase.database().ref(`/users/${context.GET_LOGGED_IN_USER.uid}/questions`).orderByChild('pollid').equalTo(context.pollEventObject.pollid)
qRef.on('value', (snapshot) => {
const qRef = firebase.firestore().collection('questions').where('pollid', '==', context.pollEventObject.pollid)
qRef.onSnapshot((doc) => {
const tempQuestionKeys = []
snapshot.forEach((questionSnapshot) => {
doc.forEach((questionSnapshot) => {
tempQuestionKeys.push({
qid: questionSnapshot.key,
qname: questionSnapshot.val().qname,
qtype: (questionSnapshot.val().qtype === 'mc') ? 'Multiple Choice' : ((questionSnapshot.val().qtype === 'tf') ? 'True/False' : 'Short Answer'),
qobj: questionSnapshot.val()
qid: questionSnapshot.id,
qname: questionSnapshot.data().qname,
qtype: (questionSnapshot.data().qtype === 'mc') ? 'Multiple Choice' : ((questionSnapshot.data().qtype === 'tf') ? 'True/False' : 'Short Answer'),
qobj: questionSnapshot.data()
})
})
// Saves question information in a list
@ -34,18 +34,18 @@ const fetchQuestions = function (context) {
const fetchSessions = function (context) {
// Define a database reference for sessions based on a specific pollid and creates a Firebase watcher
const sessionRef = firebase.database().ref('/sessions/').orderByChild('pollid').equalTo(context.pollEventObject.pollid)
sessionRef.on('value', (snapshot) => {
const sessionRef = firebase.firestore().collection('sessions').where('pollid', '==', context.pollEventObject.pollid)
sessionRef.onSnapshot((doc) => {
let tempActiveQuestionID = ''
let tempSessionKey = ''
snapshot.forEach((sessionSnapshot) => {
tempActiveQuestionID = sessionSnapshot.val().activeqid
doc.forEach((sessionSnapshot) => {
tempActiveQuestionID = sessionSnapshot.data().activeqid
})
snapshot.forEach((sessionSnapshot) => {
if (sessionSnapshot.key) {
tempSessionKey = sessionSnapshot.key
doc.forEach((sessionSnapshot) => {
if (sessionSnapshot.id) {
tempSessionKey = sessionSnapshot.id
}
})
@ -58,19 +58,18 @@ const fetchSessions = function (context) {
const fetchPolls = function (context) {
// Define database reference for user polls
const pollRef = firebase.database().ref(`/users/${context.GET_LOGGED_IN_USER.uid}/polls`)
const pollRef = firebase.firestore().collection('polls').where('owneruid', '==', context.GET_LOGGED_IN_USER.uid)
// Create Firebase watcher for user polls
pollRef.on('value', (snapshot) => {
pollRef.onSnapshot((doc) => {
const tempPollKeys = []
// Get all polls and extract data into an object
snapshot.forEach((pollSnapshot) => {
doc.forEach((pollSnapshot) => {
// Push new poll object to an array
tempPollKeys.push({
pollid: pollSnapshot.key,
pollname: pollSnapshot.val().pollname,
pollobj: pollSnapshot.val(),
sessionid: '',
deleted: false
pollid: pollSnapshot.id,
pollname: pollSnapshot.data().pollname,
pollobj: pollSnapshot.data(),
sessionid: ''
})
})
context.pollKeys = tempPollKeys
@ -80,20 +79,20 @@ const fetchPolls = function (context) {
const fetchPollSessions = function (context) {
// Getting session IDs for all polls if they exist
// Define database reference for sessions
const sessionUserRef = firebase.database().ref(`/sessions/`).orderByChild('owneruid').equalTo(context.GET_LOGGED_IN_USER.uid)
const sessionUserRef = firebase.firestore().collection('sessions').where('owneruid', '==', context.GET_LOGGED_IN_USER.uid)
// Create Firebase watcher for sessions
sessionUserRef.on('value', (sessionUserSnapshot) => {
sessionUserRef.onSnapshot((doc) => {
// If the sessions list on the DB changed at all, loop through Polls
context.pollKeys.forEach((poll, index, pollKeys) => {
// Define database reference for sessions with a given pollid
const sessionRef = firebase.database().ref('/sessions/').orderByChild('pollid').equalTo(poll.pollid)
const sessionRef = firebase.firestore().collection('sessions').where('pollid', '==', poll.pollid)
// Get the session(s) with the pollid provided
sessionRef.on('value', (snapshot) => {
sessionRef.onSnapshot((doc) => {
let tempSessionKey = ''
snapshot.forEach((sessionSnapshot) => {
doc.forEach((sessionSnapshot) => {
// If the session has a sessionid, assign that ID to the poll object
if (sessionSnapshot.key) {
tempSessionKey = sessionSnapshot.key
if (sessionSnapshot.id) {
tempSessionKey = sessionSnapshot.id
}
})
context.$set(pollKeys[index], 'sessionid', tempSessionKey)
@ -106,17 +105,13 @@ const fetchFinalResults = function (context, isActivated) {
// Check if the dialog has been activated
if (isActivated) {
// Define a database reference for user questions based on a specific qid and creates a Firebase watcher
const sessionRef = firebase.database().ref(`/users/${context.GET_LOGGED_IN_USER.uid}/questions/${context.qid}`)
sessionRef.on('value', (snapshot) => {
const sessionRef = firebase.firestore().collection('questions').doc(context.qid)
sessionRef.onSnapshot((doc) => {
context.qobj = {
qid: snapshot.key,
question: snapshot.val()
qid: doc.id,
question: doc.data()
}
})
} else {
// If the dialog is deactivated, destroy the watcher
const sessionRef = firebase.database().ref(`/users/${context.GET_LOGGED_IN_USER.uid}/questions/${context.qid}`)
sessionRef.off('value')
}
}
@ -124,12 +119,12 @@ const fetchLiveResults = function (context, isActivated) {
// Check if the dialog has been activated
if (isActivated) {
// Define a database reference for sessions based on a specific sessionid and creates a Firebase watcher
const sessionRef = firebase.database().ref(`/sessions/${context.sessionid}`)
sessionRef.on('value', (snapshot) => {
const sessionRef = firebase.firestore().collection('sessions').doc(context.sessionid)
sessionRef.onSnapshot((doc) => {
try {
context.activeQuestion = {
activequestion: snapshot.val().activequestion,
activeqid: snapshot.val().activeqid
activequestion: doc.data().activequestion,
activeqid: doc.data().activeqid
}
} catch {
context.activeQuestion = {
@ -139,20 +134,17 @@ const fetchLiveResults = function (context, isActivated) {
context.closeLiveResultsViewDialog()
}
})
} else {
const sessionRef = firebase.database().ref(`/sessions/${context.sessionid}`)
sessionRef.off('value')
}
}
const fetchActiveQuestion = function (context) {
// Define a database reference for sessions based on a specific sessionid and creates a Firebase watcher
const sessionRef = firebase.database().ref(`/sessions/${context.sessionid}`)
sessionRef.on('value', (snapshot) => {
const sessionRef = firebase.firestore().collection('sessions').doc(context.sessionid)
sessionRef.onSnapshot((doc) => {
try {
context.activeQuestion = {
activequestion: snapshot.val().activequestion,
activeqid: snapshot.val().activeqid
activequestion: doc.data().activequestion,
activeqid: doc.data().activeqid
}
} catch {
context.activeQuestion = {
@ -167,10 +159,10 @@ const fetchActiveQuestion = function (context) {
const checkSessionExists = function (context) {
if (context.pollCode.length > 0) {
// Defines a database reference to a specific session based on a given session ID (poll code)
const sessionRef = firebase.database().ref(`/sessions/${context.pollCode.toUpperCase()}`)
const sessionRef = firebase.firestore().collection('sessions').doc(context.pollCode.toUpperCase())
// Gets the session associated with the provided session ID
sessionRef.once('value', function (snapshot) {
if (snapshot.hasChildren()) {
sessionRef.get().then((doc) => {
if (doc.exists) {
context.id = context.pollCode.toUpperCase()
context.pollCode = ''
context.studentPollViewDialog = true

1
components/dialog/EditPollDialog.vue

@ -323,6 +323,7 @@ export default {
editPollDialog: function (isActivated) {
if (isActivated) {
this.editPollName = this.pollEventObject.pollobj.pollname
console.log(this.pollEventObject)
fetchQuestions(this)
fetchSessions(this)

2
components/workflow/HomeScreen.vue

@ -212,7 +212,7 @@ export default {
// If a user is authenticated, create a watcher for polls
if (this.GET_LOGGED_IN_USER) {
fetchPolls(this)
fetchPollSessions(this, this.pollKeys)
fetchPollSessions(this)
}
},
methods: {

180
functions/api.js

@ -19,17 +19,18 @@ const helpers = require('./helpers.js')
admin.initializeApp();
const rtdb = admin.database();
const firestore = admin.firestore();
module.exports.auth = {
// Check if the user is logged in and owns the poll being deleted
isOwner (context, pollid) {
console.log('Checking if user is permitted to perform this action.');
return rtdb.ref(`/users/${ context.auth.uid }/polls/${ pollid }`).once('value').then((snap) => {
return firestore.collection('polls').doc(pollid).get().then(function(doc) {
var uid = '';
try {
console.log('Trying to pull the owneruid to check for permissions.')
uid = snap.val().owneruid;
uid = doc.data().owneruid;
} catch (e) {
return false;
}
@ -50,35 +51,16 @@ module.exports.user = {
if (apiconfig.domain !== '' && !user.email.includes(apiconfig.domain)) {
admin.auth().deleteUser(user.uid);
return { status: 'error', code: 401, message: 'Permission Denied' };
} else {
return rtdb.ref(`/users/${ user.uid }`).set({
email: user.email,
name: user.displayName
}).then(() => {
console.log('Creation success!');
return { status: 'success', code: 200, message: 'User Created' };
}).catch((err) => {
// Return the error provided by the realtime database
return { status: 'error', code: 500, message: err };
})
}
},
delete (user) {
return rtdb.ref(`/users/${ user.uid }`).remove().then(() => {
const sessionRef = rtdb.ref('/sessions/').orderByChild('owneruid').equalTo(user.uid);
return sessionRef.once('value', (snapshot) => {
snapshot.forEach((sessionSnapshot) => {
module.exports.session.delete(sessionSnapshot.val().pollid);
})
})
})
}
}
module.exports.poll = {
create (context, pollname) {
// Push a new poll object with the current user's UID
return rtdb.ref(`/users/${ context.auth.uid }/polls`).push({
return firestore.collection('polls').add({
owneruid: context.auth.uid,
pollname,
questions: []
@ -93,7 +75,7 @@ module.exports.poll = {
},
edit (context, pollid, pollobj) {
// Edits the poll with the provided pollid
return rtdb.ref(`/users/${ context.auth.uid }/polls/${ pollid }`).set(pollobj).then(() => {
return firestore.collection('polls').doc(pollid).set(pollobj).then(() => {
// The poll was edited
console.log('Edit success!');
return { status: 'success', code: 200, message: 'Poll Edited' };
@ -104,26 +86,26 @@ module.exports.poll = {
},
delete (context, pollid) {
// Delete the poll with the provided pollid
return rtdb.ref(`/users/${ context.auth.uid }/polls/${ pollid }`).remove().then(() => {
return firestore.collection('polls').doc(pollid).delete().then(() => {
// Clean up questions associated with the poll
rtdb.ref(`/users/${ context.auth.uid }/questions`).orderByChild('pollid').equalTo(pollid).once('value', snapshot => {
snapshot.forEach(questionSnapshot => {
if (questionSnapshot.val().pollid === pollid) {
rtdb.ref(`/users/${ context.auth.uid }/questions/${ questionSnapshot.key }`).remove();
console.log("Poll Question Deleted");
}
firestore.collection('questions').where('pollid', '==', pollid).get().then(function(doc) {
doc.forEach(questionSnapshot => {
questionSnapshot.ref.delete();
})
})
return { status: 'success', code: 200, message: 'Questions Deleted' };
}).catch(function(err) {
return { status: 'error', code: 500, message: err };
});
// Delete the session associated with the poll
rtdb.ref('/sessions/').orderByChild('pollid').equalTo(pollid).once('value', (snapshot) => {
snapshot.forEach(sessionSnapshot => {
if (sessionSnapshot.val().pollid === pollid) {
rtdb.ref(`/sessions/${ sessionSnapshot.key }`).remove();
console.log("Session Deleted");
}
firestore.collection('sessions').where('pollid', '==', pollid).get().then(function(doc) {
doc.forEach(sessionSnapshot => {
sessionSnapshot.ref.delete();
})
})
return { status: 'success', code: 200, message: 'Session Deleted' };
}).catch(function(err) {
return { status: 'error', code: 500, message: err };
});
// The poll was deleted
console.log('Deletion success!');
@ -139,7 +121,8 @@ module.exports.poll = {
module.exports.question = {
create (context, pollid, qname, qtype, qoptions) {
// Creates a question with the provided pollid
return rtdb.ref(`/users/${ context.auth.uid }/questions/`).push({
return firestore.collection('questions').add({
owneruid: context.auth.uid,
pollid,
qname,
qtype,
@ -156,7 +139,7 @@ module.exports.question = {
},
edit (context, qid, qobj) {
// Edits the poll with the provided qid
return rtdb.ref(`/users/${ context.auth.uid }/questions/${ qid }`).set(qobj).then(() => {
return firestore.collection('questions').doc(qid).set(qobj).then(() => {
// The poll was edited
console.log('Edit success!');
return { status: 'success', code: 200, message: 'Question Edited' };
@ -167,18 +150,7 @@ module.exports.question = {
},
delete (context, qid) {
// Delete the question with the provided pollid
return rtdb.ref(`/users/${ context.auth.uid }/questions/${qid}`).once('value').then((snapshot) => {
const question = snapshot.val();
// Delete the session associated with the question
rtdb.ref('/sessions/').orderByChild('activeqid').equalTo(qid).once('value', (snapshot) => {
snapshot.forEach(sessionSnapshot => {
if (sessionSnapshot.val().activeqid === qid) {
rtdb.ref(`/sessions/${ sessionSnapshot.key }`).remove();
console.log("Session Deleted");
}
})
})
rtdb.ref(`/users/${ context.auth.uid }/questions/${qid}`).remove()
return firestore.collection('questions').doc(qid).delete().then(() => {
// The question was deleted
console.log('Deletion success!');
return { status: 'success', code: 200, message: 'Question Deleted' };
@ -193,20 +165,13 @@ module.exports.question = {
module.exports.session = {
create (context, pollid) {
// Push a new session object with the current user's UID and pollid
// TODO: Handle duplicates more gracefully. Perhaps with a recursive call and pulling db calls into helper as a function?
return rtdb.ref('/sessions/').orderByChild('pollid').equalTo(pollid).once('value').then((snapshot) => {
if (!snapshot.hasChildren()) {
return firestore.collection('sessions').where('pollid', '==', pollid).get().then(function(doc) {
if (!doc.exists) {
const sessionid = helpers.getNewID(5);
rtdb.ref(`/sessions/${ sessionid }`).transaction((session) => {
if (session === null) {
return {
pollid: pollid,
owneruid: context.auth.uid
}
} else {
return {};
}
});
firestore.collection('sessions').doc(sessionid).set({
pollid: pollid,
owneruid: context.auth.uid
})
}
console.log('Creation success!');
return { status: 'success', code: 200, message: 'Session Created' };
@ -214,12 +179,9 @@ module.exports.session = {
},
delete (pollid) {
// Delete the session associated with the poll
return rtdb.ref('/sessions/').orderByChild('pollid').equalTo(pollid).once('value').then((snapshot) => {
snapshot.forEach(sessionSnapshot => {
if (sessionSnapshot.val().pollid === pollid) {
rtdb.ref(`/sessions/${ sessionSnapshot.key }`).remove();
console.log("Session Deleted");
}
return firestore.collection('sessions').where('pollid', '==', pollid).get().then(function(doc) {
doc.forEach(sessionSnapshot => {
sessionSnapshot.ref.delete();
})
return { status: 'success', code: 200, message: 'Session Deleted' };
}).catch((err) => {
@ -227,57 +189,55 @@ module.exports.session = {
})
},
setActiveQuestion (context, qid, pollid, sessionid) {
return rtdb.ref(`/users/${context.auth.uid}/questions/${qid}/`).once('value').then((snapshot) => {
rtdb.ref(`/sessions/${sessionid}`).transaction((session) => {
if (session !== null) {
if (session.activequestion) {
module.exports.question.edit(context, session.activeqid, session.activequestion);
return firestore.collection('questions').doc(qid).get().then((doc) => {
const inQuestion = doc.data();
delete inQuestion.responses
return firestore.collection('sessions').doc(sessionid).get().then((doc) => {
if (doc.data()) {
if (doc.data().activeqid) {
module.exports.question.edit(context, doc.data().activeqid, doc.data().activequestion);
}
const inQuestion = snapshot.val();
delete inQuestion.responses
console.log(inQuestion)
return {
activeqid: qid,
}
firestore.collection('sessions').doc(sessionid).set({
activeqid: qid,
pollid,
owneruid: context.auth.uid,
activequestion: inQuestion
}
} else {
return {};
}
})
return { status: 'success', code: 200, message: 'Active Question Set' };
}).catch(function(err) {
return { status: 'error', code: 500, message: err };
});
return { status: 'success', code: 200, message: 'Transaction sent!' };
});
},
stopActiveQuestion (context, qid, pollid, sessionid) {
return rtdb.ref(`/sessions/${sessionid}`).once('value').then((snapshot) => {
rtdb.ref(`/sessions/${sessionid}`).transaction((session) => {
if (session !== null) {
module.exports.question.edit(context, qid, snapshot.val().activequestion);
return {
activeqid: null,
pollid: pollid,
owneruid: context.auth.uid,
activequestion: {}
}
} else {
return {};
}
return firestore().collection('sessions').doc(sessionid).collection(responses).doc(context.auth.token.email).get().then((doc) => {
const activequestion = doc.data().activequestion;
activequestion.responses.push({
})
module.exports.question.edit(context, qid, doc.data().activequestion);
return firestore.collection('sessions').doc(sessionid).set({
activeqid: null,
pollid: pollid,
owneruid: context.auth.uid,
activequestion: {}
}).then(() => {
return { status: 'success', code: 200, message: 'Transaction sent!' };
});
return { status: 'success', code: 200, message: 'Transaction sent!' };
});
})
},
sendResponse (context, sessionid, response) {
const activeQuestionRef = rtdb.ref(`/sessions/${sessionid}/activequestion/responses/${context.auth.uid}`);
return activeQuestionRef.once('value').then((snapshot) => {
if (snapshot !== null) {
activeQuestionRef.update({
response,
email: context.auth.token.email
})
const activeQuestionRef = firestore.collection('sessions').doc(sessionid).collection('responses').doc(context.auth.token.email);
return activeQuestionRef.set({
response,
email: context.auth.token.email
}).then((doc) => {
return { status: 'success', code: 200, message: 'Response sent!' };
}
return { status: 'error', code: 500, message: 'Response failed to send!' };
}).catch((err) => {
return { status: 'error', code: 500, message: err };
});
}
}

163
package-lock.json

@ -1008,6 +1008,50 @@
"@firebase/app-types": "0.6.0"
}
},
"@firebase/firestore": {
"version": "1.14.2",
"resolved": "https://registry.npmjs.org/@firebase/firestore/-/firestore-1.14.2.tgz",
"integrity": "sha512-gUTQHiR1LN/g+iHfPZS+GJgDHK866xtAXcodSAOU4dt7k4B0oXllwuQmhjwQP0Gh7Lc/m+cK7dw/bmoHI6oWqQ==",
"requires": {
"@firebase/component": "0.1.10",
"@firebase/firestore-types": "1.10.1",
"@firebase/logger": "0.2.2",
"@firebase/util": "0.2.45",
"@firebase/webchannel-wrapper": "0.2.39",
"@grpc/grpc-js": "0.8.1",
"@grpc/proto-loader": "^0.5.0",
"tslib": "1.11.1"
},
"dependencies": {
"@firebase/component": {
"version": "0.1.10",
"resolved": "https://registry.npmjs.org/@firebase/component/-/component-0.1.10.tgz",
"integrity": "sha512-Iy1+f8wp6mROz19oxWUd31NxMlGxtW1IInGHITnVa6eZtXOg0lxcbgYeLp9W3PKzvvNfshHU0obDkcMY97zRAw==",
"requires": {
"@firebase/util": "0.2.45",
"tslib": "1.11.1"
}
},
"@firebase/logger": {
"version": "0.2.2",
"resolved": "https://registry.npmjs.org/@firebase/logger/-/logger-0.2.2.tgz",
"integrity": "sha512-MbEy17Ha1w/DlLtvxG89ScQ+0+yoElGKJ1nUCQHHLjeMNsRwd2wnUPOVCsZvtBzQp8Z0GaFmD4a2iG2v91lEbA=="
},
"@firebase/util": {
"version": "0.2.45",
"resolved": "https://registry.npmjs.org/@firebase/util/-/util-0.2.45.tgz",
"integrity": "sha512-k3IqXaIgwlPg7m5lXmMUtkqA/p+LMFkFQIqBuDtdT0iyWB6kQDokyjw2Sgd3GoTybs6tWqUKFZupZpV6r73UHw==",
"requires": {
"tslib": "1.11.1"
}
}
}
},
"@firebase/firestore-types": {
"version": "1.10.1",
"resolved": "https://registry.npmjs.org/@firebase/firestore-types/-/firestore-types-1.10.1.tgz",
"integrity": "sha512-vyKdm+AYUFT8XeUX62IOqaqPFCs/mAMoSEsqIz9HnSVsqCw/IocNjtjSa+3M80kRw4V8fI7JI+Xz6Wg5VJXLqA=="
},
"@firebase/functions": {
"version": "0.4.38",
"resolved": "https://registry.npmjs.org/@firebase/functions/-/functions-0.4.38.tgz",
@ -1043,6 +1087,35 @@
"tslib": "1.11.1"
}
},
"@firebase/webchannel-wrapper": {
"version": "0.2.39",
"resolved": "https://registry.npmjs.org/@firebase/webchannel-wrapper/-/webchannel-wrapper-0.2.39.tgz",
"integrity": "sha512-V5oQjtYxHlEpWdQr68ZFo8T+3NVccrTieRy8RnzYIasCeptxOxwYUG0cAAKmalgrrrfRJdXup8h5ybi3XSW9Hw=="
},
"@grpc/grpc-js": {
"version": "0.8.1",
"resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-0.8.1.tgz",
"integrity": "sha512-e8gSjRZnOUefsR3obOgxG9RtYW2Mw83hh7ogE2ByCdgRhoX0mdnJwBcZOami3E0l643KCTZvORFwfSEi48KFIQ==",
"requires": {
"semver": "^6.2.0"
},
"dependencies": {
"semver": {
"version": "6.3.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
"integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw=="
}
}
},
"@grpc/proto-loader": {
"version": "0.5.4",
"resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.5.4.tgz",
"integrity": "sha512-HTM4QpI9B2XFkPz7pjwMyMgZchJ93TVkL3kWPW8GDMDKYxsMnmf4w2TNMJK7+KNiYHS5cJrCEAFlF+AwtXWVPA==",
"requires": {
"lodash.camelcase": "^4.3.0",
"protobufjs": "^6.8.6"
}
},
"@jest/console": {
"version": "24.9.0",
"resolved": "https://registry.npmjs.org/@jest/console/-/console-24.9.0.tgz",
@ -1895,6 +1968,60 @@
}
}
},
"@protobufjs/aspromise": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz",
"integrity": "sha1-m4sMxmPWaafY9vXQiToU00jzD78="
},
"@protobufjs/base64": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz",
"integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg=="
},
"@protobufjs/codegen": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz",
"integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg=="
},
"@protobufjs/eventemitter": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz",
"integrity": "sha1-NVy8mLr61ZePntCV85diHx0Ga3A="
},
"@protobufjs/fetch": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz",
"integrity": "sha1-upn7WYYUr2VwDBYZ/wbUVLDYTEU=",
"requires": {
"@protobufjs/aspromise": "^1.1.1",
"@protobufjs/inquire": "^1.1.0"
}
},
"@protobufjs/float": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz",
"integrity": "sha1-Xp4avctz/Ap8uLKR33jIy9l7h9E="
},
"@protobufjs/inquire": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz",
"integrity": "sha1-/yAOPnzyQp4tyvwRQIKOjMY48Ik="
},
"@protobufjs/path": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz",
"integrity": "sha1-bMKyDFya1q0NzP0hynZz2Nf79o0="
},
"@protobufjs/pool": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz",
"integrity": "sha1-Cf0V8tbTq/qbZbw2ZQbWrXhG/1Q="
},
"@protobufjs/utf8": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz",
"integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA="
},
"@testim/chrome-version": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/@testim/chrome-version/-/chrome-version-1.0.7.tgz",
@ -1995,6 +2122,11 @@
"integrity": "sha512-8+KAKzEvSUdeo+kmqnKrqgeE+LcA0tjYWFY7RPProVYwnqDjukzO+3b6dLD56rYX5TdWejnEOLJYOIeh4CXKuA==",
"dev": true
},
"@types/long": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.1.tgz",
"integrity": "sha512-5tXH6Bx/kNGd3MgffdmP4dy2Z+G4eaXw0SE81Tq3BNadtnMR5/ySMzX4SLEzHJzSmPNn4HIdpQsBvXMUykr58w=="
},
"@types/minimatch": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz",
@ -2004,8 +2136,7 @@
"@types/node": {
"version": "13.9.5",
"resolved": "https://registry.npmjs.org/@types/node/-/node-13.9.5.tgz",
"integrity": "sha512-hkzMMD3xu6BrJpGVLeQ3htQQNAcOrJjX7WFmtK8zWQpz2UJf13LCFF2ALA7c9OVdvc2vQJeDdjfR35M0sBCxvw==",
"dev": true
"integrity": "sha512-hkzMMD3xu6BrJpGVLeQ3htQQNAcOrJjX7WFmtK8zWQpz2UJf13LCFF2ALA7c9OVdvc2vQJeDdjfR35M0sBCxvw=="
},
"@types/q": {
"version": "1.5.2",
@ -9508,8 +9639,7 @@
"lodash.camelcase": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz",
"integrity": "sha1-soqmKIorn8ZRA1x3EfZathkDMaY=",
"dev": true
"integrity": "sha1-soqmKIorn8ZRA1x3EfZathkDMaY="
},
"lodash.clone": {
"version": "3.0.3",
@ -9654,6 +9784,11 @@
}
}
},
"long": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz",
"integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA=="
},
"loose-envify": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",
@ -12099,6 +12234,26 @@
"integrity": "sha1-IS1b/hMYMGpCD2QCuOJv85ZHqEk=",
"dev": true
},
"protobufjs": {
"version": "6.9.0",
"resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.9.0.tgz",
"integrity": "sha512-LlGVfEWDXoI/STstRDdZZKb/qusoAWUnmLg9R8OLSO473mBLWHowx8clbX5/+mKDEI+v7GzjoK9tRPZMMcoTrg==",
"requires": {
"@protobufjs/aspromise": "^1.1.2",
"@protobufjs/base64": "^1.1.2",
"@protobufjs/codegen": "^2.0.4",
"@protobufjs/eventemitter": "^1.1.0",
"@protobufjs/fetch": "^1.1.0",
"@protobufjs/float": "^1.0.2",
"@protobufjs/inquire": "^1.1.0",
"@protobufjs/path": "^1.1.2",
"@protobufjs/pool": "^1.1.0",
"@protobufjs/utf8": "^1.1.0",
"@types/long": "^4.0.1",
"@types/node": "^13.7.0",
"long": "^4.0.0"
}
},
"proxy-addr": {
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.6.tgz",

1
package.json

@ -17,6 +17,7 @@
"@firebase/app": "^0.6.0",
"@firebase/auth": "^0.14.1",
"@firebase/database": "^0.5.24",
"@firebase/firestore": "^1.14.2",
"@firebase/functions": "^0.4.38",
"@mdi/font": "^5.0.45",
"@mdi/js": "^5.0.45",

8
plugins/firebase/firebase.js

@ -16,6 +16,7 @@ along with Pollo. If not, see <https://www.gnu.org/licenses/>. */
import firebase from '@firebase/app'
import '@firebase/auth'
import '@firebase/database'
import '@firebase/firestore'
import '@firebase/functions'
import { fb } from './firebase_config'
@ -24,11 +25,8 @@ firebase.initializeApp(fb)
// Export firebase variables
const auth = firebase.auth()
// Import using: import { database } from '@firebase/app'
// Call methods using: database()._____
const database = firebase.database()
// Import using: import { firestore } from '@firebase/app'
// Call methods using: firestore()._____
const functions = firebase.functions()
const firestore = firebase.firestore()
export { auth, database, functions }
export { auth, database, functions, firestore }