From 4978659bf9646d0070b5e4cd6cb1938dbf8ba712 Mon Sep 17 00:00:00 2001 From: regalijan Date: Thu, 19 Oct 2023 16:51:19 -0400 Subject: [PATCH] Store fcm token in report data --- functions/api/reports/submit.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/functions/api/reports/submit.ts b/functions/api/reports/submit.ts index 0692a8d..faf6b27 100644 --- a/functions/api/reports/submit.ts +++ b/functions/api/reports/submit.ts @@ -2,8 +2,15 @@ import { GenerateUploadURL } from "../../gcloud.js"; import { jsonError, jsonResponse } from "../../common.js"; export async function onRequestPost(context: RequestContext) { - const { actions, bypass, description, files, turnstileResponse, usernames } = - context.data.body; + const { + actions, + bypass, + description, + files, + senderTokenId, + turnstileResponse, + usernames, + } = context.data.body; if (!context.data.current_user) { if (typeof turnstileResponse !== "string") @@ -200,6 +207,7 @@ export async function onRequestPost(context: RequestContext) { JSON.stringify({ attachments, created_at: Date.now(), + fcm_token: typeof senderTokenId === "string" ? senderTokenId : undefined, id: reportId, open: !bypass, user: currentUser