Add email and fcm token to inactivity notice data

This commit is contained in:
regalijan 2023-10-20 13:54:30 -04:00
parent 4adae3af51
commit 6ea7fae377
Signed by: regalijan
GPG Key ID: 5D4196DA269EF520

View File

@ -1,7 +1,7 @@
import validateInactivity from "./validate.js"; import validateInactivity from "./validate.js";
export async function onRequestPost(context: RequestContext) { 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( const validationFailureResponse = validateInactivity(
departments, departments,
@ -24,11 +24,13 @@ export async function onRequestPost(context: RequestContext) {
created_at: Date.now(), created_at: Date.now(),
departments, departments,
end, end,
fcm_token: typeof senderTokenId === "string" ? senderTokenId : undefined,
open: true, open: true,
reason, reason,
start, start,
user: { user: {
id: context.data.current_user.id, id: context.data.current_user.id,
email: context.data.current_user.email,
username: context.data.current_user.username, username: context.data.current_user.username,
}, },
}), }),