Created an e-mail type to be sent to the ticket reporter with the ticket's information

This commit is contained in:
Tiago Ribeiro
2024-01-29 13:19:12 +00:00
parent 800d04da37
commit 2c4168a014
3 changed files with 64 additions and 7 deletions

View File

@@ -45,11 +45,6 @@ async function get(req: NextApiRequest, res: NextApiResponse) {
async function post(req: NextApiRequest, res: NextApiResponse) {
const body = req.body as Invite;
const shortUID = new ShortUniqueId();
await setDoc(doc(db, "invites", body.id || shortUID.randomUUID(8)), body);
res.status(200).json({ ok: true });
const invitedRef = await getDoc(doc(db, "users", body.to));
if (!invitedRef.exists()) return res.status(404).json({ ok: false });
@@ -76,4 +71,9 @@ async function post(req: NextApiRequest, res: NextApiResponse) {
} catch (e) {
console.log(e);
}
const shortUID = new ShortUniqueId();
await setDoc(doc(db, "invites", body.id || shortUID.randomUUID(8)), body);
res.status(200).json({ ok: true });
}