i-darrshan's picture
initial update of the vite site
62c3fe0
raw
history blame contribute delete
780 Bytes
const {runQuery, runSelectQuery} = require('./queries');
// Check existing contact request
async function checkExistingContactRequest(name, email, subject) {
const checkQuery = `SELECT * FROM contact_requests WHERE name = ? AND email = ? AND subject = ?;`;
const results = await runSelectQuery(checkQuery, [name, email, subject]);
return results.length > 0;
}
// Insert contact request
async function insertContactRequest(name, email, phone, subject, message) {
const insertQuery = `INSERT INTO contact_requests (date, time, name, email, phone, subject, message) VALUES (DATE("now"), TIME("now"), ?, ?, ?, ?, ?);`;
await runQuery(insertQuery, [name, email, phone, subject, message]);
}
module.exports = { checkExistingContactRequest, insertContactRequest };