From 6ea7fae377eb41c9bb2366c18435758574508bf3 Mon Sep 17 00:00:00 2001 From: regalijan Date: Fri, 20 Oct 2023 13:54:30 -0400 Subject: [PATCH] Add email and fcm token to inactivity notice data --- functions/api/inactivity/new.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/functions/api/inactivity/new.ts b/functions/api/inactivity/new.ts index f98c143..8795e30 100644 --- a/functions/api/inactivity/new.ts +++ b/functions/api/inactivity/new.ts @@ -1,7 +1,7 @@ import validateInactivity from "./validate.js"; export async function onRequestPost(context: RequestContext) { - const { departments, end, reason, start } = context.data.body; + const { departments, end, reason, senderTokenId, start } = context.data.body; const validationFailureResponse = validateInactivity( departments, @@ -24,11 +24,13 @@ export async function onRequestPost(context: RequestContext) { created_at: Date.now(), departments, end, + fcm_token: typeof senderTokenId === "string" ? senderTokenId : undefined, open: true, reason, start, user: { id: context.data.current_user.id, + email: context.data.current_user.email, username: context.data.current_user.username, }, }),