From e9d1bf05b881c63347207d5822d5d317ef15706b Mon Sep 17 00:00:00 2001 From: Lyton Date: Sun, 20 Oct 2024 16:35:42 -0500 Subject: [PATCH] feat: implemented user invite with sendgrid --- api/.env | 1 - api/assets/pww-logo.png | Bin 0 -> 22150 bytes api/package-lock.json | 93 ++++++++++++++++++++++++++++++++++++---- api/package.json | 3 +- api/src/routes/user.ts | 39 +++++++++++++++-- api/src/server.ts | 4 +- 6 files changed, 123 insertions(+), 17 deletions(-) delete mode 100644 api/.env create mode 100644 api/assets/pww-logo.png diff --git a/api/.env b/api/.env deleted file mode 100644 index d32fc87..0000000 --- a/api/.env +++ /dev/null @@ -1 +0,0 @@ -MONGO_URI=mongodb+srv://User2:kanersdoghouse@bare-bones.pxrwg.mongodb.net/FlatFairDB?retryWrites=true&w=majority&appName=Bare-Bones diff --git a/api/assets/pww-logo.png b/api/assets/pww-logo.png new file mode 100644 index 0000000000000000000000000000000000000000..c0f5a066c7ac226d9a665d8574c106dc83fb18e4 GIT binary patch literal 22150 zcmbSy1ymbA(;!Z<;;uyt6n7|4+&#gixVw9?65L90_u%dnC{WykyF0YFU;5d*|McDE zy(F7tc1Lz+b}SL9$}$+JB&aYjFc@;OlIk!puw2lw-y0<8E8;sX4d@$+ldO&_3=A6X z-zO|gdL|JJ48oZ;K-*1QNm0<$(Vo@V%+bW0)yv)q3JnAEQPj)H*wohCjmpH_(%M0o z`n>%IHI=oQFtrws61$RHc{gzBT0AantHb2nouFMB%& zS3xgf>VK>&2p#|ZnvI(3A0TeF!qj4a5mIR@sZvQex|mZ5uyU}Nva@qi@d>b+@R{;* zo0@*0;$-LKW@G1Lf(%jY5#oEcu+R=gP?~2AI zj_z*4)KF6Y$%DPqf0lJ{{g<4e5@Yi+c4FgTW&g|5KLE{4{{!db?qc^3PIP*{%tz&cqux;eU9IsR{!{?E_<1p!pHN=pC1@xP?S-u^!*T-~HRpltk0Apc8f zSAe&ZIh(qycHg(%8*hnELOov2d`naB=|HIRrV`1$nqw*m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z$Gn%SP;@1!lTkgd?&Yy!>xNYyC41;(vWGs;zNLN$*ryB@XJvRLm#8s?vGN6a3}Mg z|7mMjSgXjsEuE@9v24od0}?N*ma@rLye#M&_2$s5EoNgTU7uN*H*(kqfoP8^Z}ze5lMk>xTOsyd-ora3Ufec3E$u`Wj+};FkMU z?f*%Xhs3Eln7HBMJ-}zcK?H^^AuwzSd#&YMk@=--^MhU08>1iCxcuN~`I6pyBm^ zg|L^vuqDv;#przpA_Sl9%$37GrkiyMs#~$l-!hU#=vuDNtfXk^E5H>X ztD4l^vnLFlcY|ER{Nf)la#(8yh-@Y7?I2fDwDf31Zf1V*bd3C&U~xKd5Ms9{7#!Tl zS>25XL7#@s&w_MB)Q9pgeeKI2t$_JUpGN2hR1x6=eAQ(Hi?;zEqnw6lY@cY6KNBn- zglYiv2?Bkq2_|5@B)SC!yi6fjyci-Sb!G4PR?;W(7Vt1dOP@x|GbvhnH`TsbNY#53 z6|Z1(qzaMF*!ss-5oXJ#jCv&Fko`{JSd8wN}E~`rHyY zc|EF`1@m6LRK)rNa1uZdHS|y)!|=612~-GyDp71zd|tvnV?4gv1-{h$Mkc z0_?4s#|p$m!%|i4-HW&FOvHSOtvj%EW^@cd<=4^J`X;*4S-<=r^gY{vTufBQcv}-e zX6sf&XV%2qS}0-GPxS7=7+n%v=Z-{TPYt0c$2UpD`&jOmNA?z@JeDfGi;#S;+h0-Sn2=12.*" + } + }, + "node_modules/@sendgrid/helpers": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/@sendgrid/helpers/-/helpers-8.0.0.tgz", + "integrity": "sha512-Ze7WuW2Xzy5GT5WRx+yEv89fsg/pgy3T1E3FS0QEx0/VvRmigMZ5qyVGhJz4SxomegDkzXv/i0aFPpHKN8qdAA==", + "dependencies": { + "deepmerge": "^4.2.2" + }, + "engines": { + "node": ">= 12.0.0" + } + }, + "node_modules/@sendgrid/mail": { + "version": "8.1.4", + "resolved": "https://registry.npmjs.org/@sendgrid/mail/-/mail-8.1.4.tgz", + "integrity": "sha512-MUpIZykD9ARie8LElYCqbcBhGGMaA/E6I7fEcG7Hc2An26QJyLtwOaKQ3taGp8xO8BICPJrSKuYV4bDeAJKFGQ==", + "dependencies": { + "@sendgrid/client": "^8.1.4", + "@sendgrid/helpers": "^8.0.0" + }, + "engines": { + "node": ">=12.*" + } + }, "node_modules/@tsconfig/node10": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.11.tgz", @@ -155,11 +191,11 @@ "dev": true }, "node_modules/@types/node": { - "version": "22.5.4", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.5.4.tgz", - "integrity": "sha512-FDuKUJQm/ju9fT/SeX/6+gBzoPzlVCzfzmGkwKvRHQVxi4BntVbyIwf6a4Xn62mrvndLiml6z/UBXIdEVjQLXg==", + "version": "22.8.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.8.1.tgz", + "integrity": "sha512-k6Gi8Yyo8EtrNtkHXutUu2corfDf9su95VYVP10aGYMMROM6SAItZi0w1XszA6RtWTHSVp5OeFof37w0IEqCQg==", "dependencies": { - "undici-types": "~6.19.2" + "undici-types": "~6.19.8" } }, "node_modules/@types/qs": { @@ -490,6 +526,14 @@ "ms": "2.0.0" } }, + "node_modules/deepmerge": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/define-data-property": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", @@ -1991,6 +2035,32 @@ "sparse-bitfield": "^3.0.3" } }, + "@sendgrid/client": { + "version": "8.1.4", + "resolved": "https://registry.npmjs.org/@sendgrid/client/-/client-8.1.4.tgz", + "integrity": "sha512-VxZoQ82MpxmjSXLR3ZAE2OWxvQIW2k2G24UeRPr/SYX8HqWLV/8UBN15T2WmjjnEb5XSmFImTJOKDzzSeKr9YQ==", + "requires": { + "@sendgrid/helpers": "^8.0.0", + "axios": "^1.7.4" + } + }, + "@sendgrid/helpers": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/@sendgrid/helpers/-/helpers-8.0.0.tgz", + "integrity": "sha512-Ze7WuW2Xzy5GT5WRx+yEv89fsg/pgy3T1E3FS0QEx0/VvRmigMZ5qyVGhJz4SxomegDkzXv/i0aFPpHKN8qdAA==", + "requires": { + "deepmerge": "^4.2.2" + } + }, + "@sendgrid/mail": { + "version": "8.1.4", + "resolved": "https://registry.npmjs.org/@sendgrid/mail/-/mail-8.1.4.tgz", + "integrity": "sha512-MUpIZykD9ARie8LElYCqbcBhGGMaA/E6I7fEcG7Hc2An26QJyLtwOaKQ3taGp8xO8BICPJrSKuYV4bDeAJKFGQ==", + "requires": { + "@sendgrid/client": "^8.1.4", + "@sendgrid/helpers": "^8.0.0" + } + }, "@tsconfig/node10": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.11.tgz", @@ -2076,11 +2146,11 @@ "dev": true }, "@types/node": { - "version": "22.5.4", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.5.4.tgz", - "integrity": "sha512-FDuKUJQm/ju9fT/SeX/6+gBzoPzlVCzfzmGkwKvRHQVxi4BntVbyIwf6a4Xn62mrvndLiml6z/UBXIdEVjQLXg==", + "version": "22.8.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.8.1.tgz", + "integrity": "sha512-k6Gi8Yyo8EtrNtkHXutUu2corfDf9su95VYVP10aGYMMROM6SAItZi0w1XszA6RtWTHSVp5OeFof37w0IEqCQg==", "requires": { - "undici-types": "~6.19.2" + "undici-types": "~6.19.8" } }, "@types/qs": { @@ -2347,6 +2417,11 @@ "ms": "2.0.0" } }, + "deepmerge": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==" + }, "define-data-property": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", diff --git a/api/package.json b/api/package.json index e7d9129..07fd610 100644 --- a/api/package.json +++ b/api/package.json @@ -15,6 +15,7 @@ "author": "", "license": "ISC", "dependencies": { + "@sendgrid/mail": "^8.1.4", "axios": "^1.7.7", "cors": "^2.8.5", "dotenv": "^16.4.5", @@ -28,7 +29,7 @@ "devDependencies": { "@types/cors": "^2.8.17", "@types/express": "^4.17.21", - "@types/node": "^22.5.4", + "@types/node": "^22.8.1", "@types/uuid": "^10.0.0", "body-parser": "^1.20.3", "prettier": "^3.3.3", diff --git a/api/src/routes/user.ts b/api/src/routes/user.ts index b482219..0c938fb 100644 --- a/api/src/routes/user.ts +++ b/api/src/routes/user.ts @@ -1,7 +1,10 @@ -import express from "express" +import express from "express"; +import sgMail from "@sendgrid/mail"; -const router = express.Router() -const axios = require("axios").default +const router = express.Router(); +const axios = require("axios").default; + +router.use(express.json()); router.post("/test", async (req: any, res: any) => { console.log("Received group data:") @@ -10,4 +13,32 @@ router.post("/test", async (req: any, res: any) => { return res.status(200).json(name) }) -export default router +router.post("/send-email", async (req: any, res: any) => { + try { + const SENDGRID_API_KEY = process.env.SEND_GRID_API_KEY || ""; + const SEND_GRID_TEST_EMAIL = process.env.SEND_GRID_TEST_EMAIL || ""; + + if (SENDGRID_API_KEY === "" || SEND_GRID_TEST_EMAIL === "") { + throw new Error("SendGrid API key or test email is missing"); + } + + const { email, name } = req.body; + + sgMail.setApiKey(SENDGRID_API_KEY); + + await sgMail.send({ + to: email, + from: SEND_GRID_TEST_EMAIL, + templateId: "d-7e26b82cf8624bafa4077b6ed73b52bf", + dynamicTemplateData: { + name: name, + }, + }); + + return res.status(200).json({ message: "Email successfully sent" }); + } catch (err) { + return res.status(400).json({ message: "Email sending failed" }); + } +}); + +export default router; diff --git a/api/src/server.ts b/api/src/server.ts index 7543d60..ad15349 100644 --- a/api/src/server.ts +++ b/api/src/server.ts @@ -1,6 +1,6 @@ -import express from "express" +import express from "express"; import bodyParser from "body-parser" -import connectDB from "./config/db" +import connectDB from "./config/db"; import * as routes from "./routes/index"