v1.1.0/setup emulators
This commit is contained in:
@@ -37,6 +37,28 @@ const serializeGaId = (_gaid: string): string => {
|
||||
return "";
|
||||
};
|
||||
|
||||
if (process.env.NODE_ENV && process.env.NODE_ENV === "dev") {
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const backup = require("./backup.json");
|
||||
const BackupResults : Record<string, Record<string,
|
||||
boolean | Record<string, unknown> | string>> =
|
||||
backup.results;
|
||||
|
||||
const BackupStats : Record<string,
|
||||
Record<string, unknown> |
|
||||
Record<string, number> |
|
||||
Record<string, Record<string, number> |
|
||||
Record<string, Record<string, Record<string, number>>>>> =
|
||||
backup.stats;
|
||||
|
||||
Object.keys(BackupResults).forEach((key : string) => {
|
||||
admin.firestore().collection("results").doc(key).set(BackupResults[key]);
|
||||
});
|
||||
Object.keys(BackupStats).forEach((key : string) => {
|
||||
admin.firestore().collection("stats").doc(key).set(BackupStats[key]);
|
||||
});
|
||||
}
|
||||
|
||||
export const saveResult = functions.https.onCall(
|
||||
async (data: SaveResultRequestData, context) => {
|
||||
if (!!data && !!context) {
|
||||
|
||||
Reference in New Issue
Block a user