Store fcm token in report data

This commit is contained in:
regalijan 2023-10-19 16:51:19 -04:00
parent ea98d7d0de
commit 4978659bf9
Signed by: regalijan
GPG Key ID: 5D4196DA269EF520

View File

@ -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