feat: Add privacyAccepted and timeSubmitted properties to DB and mailer

This commit is contained in:
2025-08-25 23:34:03 -05:00
parent f9b4eb68f1
commit d1e5c63dd2

View File

@@ -2,13 +2,13 @@
module.exports = (pool, transporter) => { module.exports = (pool, transporter) => {
const submitForm = async (req, res) => { const submitForm = async (req, res) => {
const { firstName, lastName, organization, email, phone, contactMethod, message } = req.body; const { firstName, lastName, organization, email, phone, contactMethod, message, privacyAccepted } = req.body;
try { try {
const result = await pool.query( const result = await pool.query(
`INSERT INTO submissions(first_name, last_name, organization, email, phone, contact_method, message) `INSERT INTO submissions(first_name, last_name, organization, email, phone, contact_method, message, privacy_accepted, time_submitted)
VALUES($1, $2, $3, $4, $5, $6, $7) RETURNING *`, VALUES($1, $2, $3, $4, $5, $6, $7, $8) RETURNING *`,
[firstName, lastName, organization, email, phone, contactMethod, message] [firstName, lastName, organization, email, phone, contactMethod, message, privacyAccepted]
); );
console.log('Successfully saved submission to the database:', result.rows[0]); console.log('Successfully saved submission to the database:', result.rows[0]);
@@ -26,6 +26,8 @@ module.exports = (pool, transporter) => {
<li><strong>Email:</strong> ${email}</li> <li><strong>Email:</strong> ${email}</li>
<li><strong>Phone:</strong> ${phone}</li> <li><strong>Phone:</strong> ${phone}</li>
<li><strong>Contact Method:</strong> ${contactMethod}</li> <li><strong>Contact Method:</strong> ${contactMethod}</li>
<li><strong>Privacy Policy Accepted:</strong> ${privacyAccepted}</li>
<li><strong>Submission Time:</strong> ${result.rows[0].time_submitted}</li>
</ul> </ul>
<p><strong>Message:</strong></p> <p><strong>Message:</strong></p>
<p>${message}</p> <p>${message}</p>