Fix variable declarations left from unit testing
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
/* eslint-disable indent */
|
/* eslint-disable indent */
|
||||||
/* eslint-disable no-tabs */
|
/* eslint-disable no-tabs */
|
||||||
const functions = require("firebase-functions").region("europe-west2");//.region("europe-west2")
|
const functions = require("firebase-functions");//.region("europe-west2")
|
||||||
const admin = require("firebase-admin");
|
const admin = require("firebase-admin");
|
||||||
admin.initializeApp();
|
admin.initializeApp();
|
||||||
const db = admin.firestore();
|
const db = admin.firestore();
|
||||||
@@ -64,8 +64,8 @@ exports.userDeleted = functions.auth.user().onDelete((user) => {
|
|||||||
* NOTE: can't be unit tested
|
* NOTE: can't be unit tested
|
||||||
*/
|
*/
|
||||||
exports.getGroupMembers = functions.https.onCall((data, context) => {
|
exports.getGroupMembers = functions.https.onCall((data, context) => {
|
||||||
// const uid = context.auth.uid;
|
const uid = context.auth.uid;
|
||||||
const uid = "M3JPrFRH6Fdo8XMUbF0l2zVZUCH3";
|
// const uid = "M3JPrFRH6Fdo8XMUbF0l2zVZUCH3";
|
||||||
|
|
||||||
if (context.app == undefined && !LOCAL_TESTING) {
|
if (context.app == undefined && !LOCAL_TESTING) {
|
||||||
throw new functions.https.HttpsError(
|
throw new functions.https.HttpsError(
|
||||||
@@ -146,8 +146,8 @@ exports.getGroupMembers = functions.https.onCall((data, context) => {
|
|||||||
* @return {string} The ID of the created progress document.
|
* @return {string} The ID of the created progress document.
|
||||||
*/
|
*/
|
||||||
exports.createProgress = functions.https.onCall((data, context) => {
|
exports.createProgress = functions.https.onCall((data, context) => {
|
||||||
// const uid = context.auth.uid;
|
const uid = context.auth.uid;
|
||||||
const uid = "M3JPrFRH6Fdo8XMUbF0l2zVZUCH3";
|
// const uid = "M3JPrFRH6Fdo8XMUbF0l2zVZUCH3";
|
||||||
|
|
||||||
if (context.app == undefined && !LOCAL_TESTING) {
|
if (context.app == undefined && !LOCAL_TESTING) {
|
||||||
throw new functions.https.HttpsError(
|
throw new functions.https.HttpsError(
|
||||||
@@ -383,8 +383,8 @@ function cleanseVocabString(item) {
|
|||||||
* @return {integer} totalIncorrect Total number of incorrect answers so far.
|
* @return {integer} totalIncorrect Total number of incorrect answers so far.
|
||||||
*/
|
*/
|
||||||
exports.processAnswer = functions.https.onCall((data, context) => {
|
exports.processAnswer = functions.https.onCall((data, context) => {
|
||||||
// const uid = context.auth.uid;
|
const uid = context.auth.uid;
|
||||||
const uid = "M3JPrFRH6Fdo8XMUbF0l2zVZUCH3";
|
// const uid = "M3JPrFRH6Fdo8XMUbF0l2zVZUCH3";
|
||||||
|
|
||||||
if (context.app == undefined && !LOCAL_TESTING) {
|
if (context.app == undefined && !LOCAL_TESTING) {
|
||||||
throw new functions.https.HttpsError(
|
throw new functions.https.HttpsError(
|
||||||
@@ -546,10 +546,10 @@ exports.processAnswer = functions.https.onCall((data, context) => {
|
|||||||
* @return {promise} The promise from setting the target user's admin custom auth claim.
|
* @return {promise} The promise from setting the target user's admin custom auth claim.
|
||||||
*/
|
*/
|
||||||
exports.setAdmin = functions.https.onCall(async (data, context) => {
|
exports.setAdmin = functions.https.onCall(async (data, context) => {
|
||||||
// const uid = context.auth.uid;
|
const uid = context.auth.uid;
|
||||||
// const isAdmin = context.auth.tokens.admin;
|
const isAdmin = context.auth.tokens.admin;
|
||||||
const uid = "M3JPrFRH6Fdo8XMUbF0l2zVZUCH3";//nobVRmshkZNkrPbwgmPqNYrk55v2
|
// const uid = "M3JPrFRH6Fdo8XMUbF0l2zVZUCH3";//nobVRmshkZNkrPbwgmPqNYrk55v2
|
||||||
const isAdmin = true;
|
// const isAdmin = true;
|
||||||
|
|
||||||
if (context.app == undefined && !LOCAL_TESTING) {
|
if (context.app == undefined && !LOCAL_TESTING) {
|
||||||
throw new functions.https.HttpsError(
|
throw new functions.https.HttpsError(
|
||||||
@@ -581,12 +581,12 @@ exports.setAdmin = functions.https.onCall(async (data, context) => {
|
|||||||
* @return {boolean} true, to show the function has succeeded.
|
* @return {boolean} true, to show the function has succeeded.
|
||||||
*/
|
*/
|
||||||
exports.addSetToGroup = functions.https.onCall((data, context) => {
|
exports.addSetToGroup = functions.https.onCall((data, context) => {
|
||||||
// const uid = context.auth.uid;
|
const uid = context.auth.uid;
|
||||||
// const isAdmin = context.auth.token.admin;
|
const isAdmin = context.auth.token.admin;
|
||||||
// const auth = context.auth;
|
const auth = context.auth;
|
||||||
const uid = "M3JPrFRH6Fdo8XMUbF0l2zVZUCH3";
|
// const uid = "M3JPrFRH6Fdo8XMUbF0l2zVZUCH3";
|
||||||
const isAdmin = false;
|
// const isAdmin = false;
|
||||||
const auth = { uid: uid };
|
// const auth = { uid: uid };
|
||||||
|
|
||||||
if (context.app == undefined && !LOCAL_TESTING) {
|
if (context.app == undefined && !LOCAL_TESTING) {
|
||||||
throw new functions.https.HttpsError(
|
throw new functions.https.HttpsError(
|
||||||
@@ -653,12 +653,12 @@ exports.addSetToGroup = functions.https.onCall((data, context) => {
|
|||||||
* @return {promise} The promise from setting the group's updated data.
|
* @return {promise} The promise from setting the group's updated data.
|
||||||
*/
|
*/
|
||||||
exports.removeSetFromGroup = functions.https.onCall((data, context) => {
|
exports.removeSetFromGroup = functions.https.onCall((data, context) => {
|
||||||
// const uid = context.auth.uid;
|
const uid = context.auth.uid;
|
||||||
// const isAdmin = context.auth.token.admin;
|
const isAdmin = context.auth.token.admin;
|
||||||
// const auth = context.auth;
|
const auth = context.auth;
|
||||||
const uid = "M3JPrFRH6Fdo8XMUbF0l2zVZUCH3";
|
// const uid = "M3JPrFRH6Fdo8XMUbF0l2zVZUCH3";
|
||||||
const isAdmin = false;
|
// const isAdmin = false;
|
||||||
const auth = { uid: uid };
|
// const auth = { uid: uid };
|
||||||
|
|
||||||
if (context.app == undefined && !LOCAL_TESTING) {
|
if (context.app == undefined && !LOCAL_TESTING) {
|
||||||
throw new functions.https.HttpsError(
|
throw new functions.https.HttpsError(
|
||||||
@@ -783,8 +783,8 @@ async function generateJoinCode() {
|
|||||||
* @return {string} The ID of the new group's document in the groups collection.
|
* @return {string} The ID of the new group's document in the groups collection.
|
||||||
*/
|
*/
|
||||||
exports.createGroup = functions.https.onCall(async (data, context) => {
|
exports.createGroup = functions.https.onCall(async (data, context) => {
|
||||||
// const uid = context.auth.uid;
|
const uid = context.auth.uid;
|
||||||
const uid = "M3JPrFRH6Fdo8XMUbF0l2zVZUCH3";
|
// const uid = "M3JPrFRH6Fdo8XMUbF0l2zVZUCH3";
|
||||||
|
|
||||||
if (context.app == undefined && !LOCAL_TESTING) {
|
if (context.app == undefined && !LOCAL_TESTING) {
|
||||||
throw new functions.https.HttpsError(
|
throw new functions.https.HttpsError(
|
||||||
|
|||||||
Reference in New Issue
Block a user