i-darrshan commited on
Commit
051fc03
·
1 Parent(s): 1dfd045
backend/controller/applicantController.js CHANGED
@@ -3,7 +3,7 @@ const { checkExistingJobApplication, insertJobApplication } = require('../utils/
3
  const { sendEmail } = require('../utils/sendEmail');
4
 
5
  const submitJobApplication = async (req, res) => {
6
- const { name, email, phone, experience, role, linkedin, consent } = req.body;
7
  const resume = req.file;
8
 
9
  console.log('Received job application:', req.body);
@@ -35,7 +35,7 @@ const submitJobApplication = async (req, res) => {
35
  const filename = resume.originalname;
36
 
37
  // Insert application into the database
38
- await insertJobApplication(name, email, phone, experience, role, linkedin, resume.buffer, filename, consent);
39
  console.log('Job Application added to DB successfully');
40
 
41
  try{
 
3
  const { sendEmail } = require('../utils/sendEmail');
4
 
5
  const submitJobApplication = async (req, res) => {
6
+ const { name, email, phone, experience, role, linkedin, consent, policyVersion } = req.body;
7
  const resume = req.file;
8
 
9
  console.log('Received job application:', req.body);
 
35
  const filename = resume.originalname;
36
 
37
  // Insert application into the database
38
+ await insertJobApplication(name, email, phone, experience, role, linkedin, resume.buffer, filename, consent, policyVersion);
39
  console.log('Job Application added to DB successfully');
40
 
41
  try{
backend/controller/contactController.js CHANGED
@@ -9,7 +9,7 @@ const { useVapi} = require("../config");
9
  const assistant_url = 'https://api.vapi.ai/call';
10
 
11
  const submitContactForm = async (req, res) => {
12
- const { name, email, phone, subject, message, consent } = req.body;
13
  console.log('Received contact form submission:', req.body);
14
 
15
  if (!name || !email || !phone || !subject || !message) {
@@ -24,7 +24,7 @@ const submitContactForm = async (req, res) => {
24
  return res.status(400).send({ error: 'Your contact request with the same subject is in queue' });
25
  }
26
 
27
- await insertContactRequest(name, email, phone, subject, message, consent);
28
  console.log('Contact request added successfully');
29
 
30
  try{
 
9
  const assistant_url = 'https://api.vapi.ai/call';
10
 
11
  const submitContactForm = async (req, res) => {
12
+ const { name, email, phone, subject, message, consent, policyVersion } = req.body;
13
  console.log('Received contact form submission:', req.body);
14
 
15
  if (!name || !email || !phone || !subject || !message) {
 
24
  return res.status(400).send({ error: 'Your contact request with the same subject is in queue' });
25
  }
26
 
27
+ await insertContactRequest(name, email, phone, subject, message, consent, policyVersion);
28
  console.log('Contact request added successfully');
29
 
30
  try{
backend/controller/demoRequestController.js CHANGED
@@ -12,7 +12,7 @@ const { useVapi} = require("../config");
12
  const assistant_url = 'https://api.vapi.ai/call';
13
 
14
  const demoRequest = async (req, res) => {
15
- const { name, email, company, product, demoDate, selectedSlot, phone, additionalComments, timezone, consent } = req.body;
16
  console.log('Received demo request:', req.body);
17
 
18
  // Basic validation on the server side
@@ -61,7 +61,7 @@ const demoRequest = async (req, res) => {
61
  console.log('Converted time range to Asia/Kolkata:', formattedRange);
62
 
63
  // 2. Insert the new demo request into the database
64
- await insertDemoRequest(name, email, company, product, convertedDemoDate, formattedRange, phone, additionalComments, consent);
65
  console.log('Demo request added successfully');
66
 
67
  const [ eventData, icsContent ] = await createGoogleCalendarEvent(name, email, demoDate, selectedSlot, product, timezone);
 
12
  const assistant_url = 'https://api.vapi.ai/call';
13
 
14
  const demoRequest = async (req, res) => {
15
+ const { name, email, company, product, demoDate, selectedSlot, phone, additionalComments, timezone, consent, policyVersion } = req.body;
16
  console.log('Received demo request:', req.body);
17
 
18
  // Basic validation on the server side
 
61
  console.log('Converted time range to Asia/Kolkata:', formattedRange);
62
 
63
  // 2. Insert the new demo request into the database
64
+ await insertDemoRequest(name, email, company, product, convertedDemoDate, formattedRange, phone, additionalComments, consent, policyVersion);
65
  console.log('Demo request added successfully');
66
 
67
  const [ eventData, icsContent ] = await createGoogleCalendarEvent(name, email, demoDate, selectedSlot, product, timezone);
backend/utils/contactRequestDB.js CHANGED
@@ -8,9 +8,10 @@ async function checkExistingContactRequest(name, email, subject) {
8
  }
9
 
10
  // Insert contact request
11
- async function insertContactRequest(name, email, phone, subject, message, consent) {
12
- const insertQuery = `INSERT INTO contact_requests (date, time, name, email, phone, subject, message, consent) VALUES (DATE("now"), TIME("now"), ?, ?, ?, ?, ?, ?);`;
13
- await runQuery(insertQuery, [name, email, phone, subject, message, consent]);
 
14
  }
15
 
16
  module.exports = { checkExistingContactRequest, insertContactRequest };
 
8
  }
9
 
10
  // Insert contact request
11
+ async function insertContactRequest(name, email, phone, subject, message, consent, policyVersion) {
12
+ const insertQuery = `INSERT INTO contact_requests (date, time, name, email, phone, subject, message, consent, policyVersion) VALUES (DATE("now"), TIME("now"), ?, ?, ?, ?, ?, ?, ?);`;
13
+ const boolConsent = consent?1:0;
14
+ await runQuery(insertQuery, [name, email, phone, subject, message, boolConsent, policyVersion]);
15
  }
16
 
17
  module.exports = { checkExistingContactRequest, insertContactRequest };
backend/utils/demoRequestDB.js CHANGED
@@ -11,12 +11,12 @@ async function checkExistingDemoRequest(name, email, product, demoDate, phone) {
11
  }
12
 
13
  // Insert demo request
14
- async function insertDemoRequest(name, email, company, product, demoDate, slot, phone, message, consent) {
15
  const insertQuery = `
16
- INSERT INTO demo_requests (date, time, name, email, company, product, demo_date, slot, phone, comments, consent)
17
- VALUES (DATE("now"), TIME("now"), ?, ?, ?, ?, ?, ?, ?, ?, ?);
18
  `;
19
- await runQuery(insertQuery, [name, email, company, product, demoDate, slot, phone, message, consent]);
20
  }
21
 
22
  module.exports = { checkExistingDemoRequest, insertDemoRequest };
 
11
  }
12
 
13
  // Insert demo request
14
+ async function insertDemoRequest(name, email, company, product, demoDate, slot, phone, message, consent, policyVersion) {
15
  const insertQuery = `
16
+ INSERT INTO demo_requests (date, time, name, email, company, product, demo_date, slot, phone, comments, consent, policyVersion)
17
+ VALUES (DATE("now"), TIME("now"), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);
18
  `;
19
+ await runQuery(insertQuery, [name, email, company, product, demoDate, slot, phone, message, consent, policyVersion]);
20
  }
21
 
22
  module.exports = { checkExistingDemoRequest, insertDemoRequest };
backend/utils/jobRequestDB.js CHANGED
@@ -9,9 +9,11 @@ async function checkExistingJobApplication(name, email, role) {
9
  }
10
 
11
  // Insert job application
12
- async function insertJobApplication(name, email, phone, experience, role, linkedin, resume, filename, consent) {
13
- const insertQuery = `INSERT INTO applicants (date, time, name, email, phone, experience, role, linkedin, resume, filename, consent) VALUES (DATE("now"), TIME("now"), ?, ?, ?, ?, ?, ?, ?, ?, ?);`;
14
- await runQuery(insertQuery, [name, email, phone, experience, role, linkedin, resume, filename, consent]);
 
 
15
  }
16
 
17
  module.exports = { checkExistingJobApplication, insertJobApplication };
 
9
  }
10
 
11
  // Insert job application
12
+ async function insertJobApplication(name, email, phone, experience, role, linkedin, resume, filename, consent, policyVersion) {
13
+ const insertQuery = `INSERT INTO applicants (date, time, name, email, phone, experience, role, linkedin, resume, filename, consent, policyVersion) VALUES (DATE("now"), TIME("now"), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);`;
14
+ const boolConsent = Number(consent === "true");
15
+ console.log(typeof(boolConsent));
16
+ await runQuery(insertQuery, [name, email, phone, experience, role, linkedin, resume, filename, boolConsent, policyVersion]);
17
  }
18
 
19
  module.exports = { checkExistingJobApplication, insertJobApplication };
backend/utils/setupDB.js CHANGED
@@ -11,7 +11,9 @@ async function initializeDatabase() {
11
  id INTEGER PRIMARY KEY AUTOINCREMENT,
12
  date TEXT,
13
  time TEXT,
14
- email TEXT NOT NULL UNIQUE
 
 
15
  )`,
16
  applicants: `CREATE TABLE IF NOT EXISTS applicants (
17
  id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -25,7 +27,8 @@ async function initializeDatabase() {
25
  linkedin TEXT,
26
  resume BLOB,
27
  filename TEXT NOT NULL,
28
- consent INTEGER NOT NULL
 
29
  )`,
30
  demo_requests: `CREATE TABLE IF NOT EXISTS demo_requests (
31
  id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -39,7 +42,8 @@ async function initializeDatabase() {
39
  slot TEXT,
40
  phone TEXT,
41
  comments TEXT,
42
- consent INTEGER NOT NULL
 
43
  )`,
44
  contact_requests: `CREATE TABLE IF NOT EXISTS contact_requests (
45
  id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -50,7 +54,8 @@ async function initializeDatabase() {
50
  phone TEXT,
51
  subject TEXT,
52
  message TEXT,
53
- consent INTEGER NOT NULL
 
54
  )`,
55
  purchases: `CREATE TABLE IF NOT EXISTS purchases (
56
  id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -61,7 +66,9 @@ async function initializeDatabase() {
61
  phone TEXT,
62
  product TEXT,
63
  subscription_plan TEXT,
64
- subscription_type TEXT
 
 
65
  )`,
66
  jobs: `CREATE TABLE IF NOT EXISTS jobs (
67
  id INTEGER PRIMARY KEY AUTOINCREMENT,
 
11
  id INTEGER PRIMARY KEY AUTOINCREMENT,
12
  date TEXT,
13
  time TEXT,
14
+ email TEXT NOT NULL UNIQUE,
15
+ consent INTEGER NOT NULL,
16
+ policyVersion INTEGER NOT NULL
17
  )`,
18
  applicants: `CREATE TABLE IF NOT EXISTS applicants (
19
  id INTEGER PRIMARY KEY AUTOINCREMENT,
 
27
  linkedin TEXT,
28
  resume BLOB,
29
  filename TEXT NOT NULL,
30
+ consent INTEGER NOT NULL,
31
+ policyVersion INTEGER NOT NULL
32
  )`,
33
  demo_requests: `CREATE TABLE IF NOT EXISTS demo_requests (
34
  id INTEGER PRIMARY KEY AUTOINCREMENT,
 
42
  slot TEXT,
43
  phone TEXT,
44
  comments TEXT,
45
+ consent INTEGER NOT NULL,
46
+ policyVersion INTEGER NOT NULL
47
  )`,
48
  contact_requests: `CREATE TABLE IF NOT EXISTS contact_requests (
49
  id INTEGER PRIMARY KEY AUTOINCREMENT,
 
54
  phone TEXT,
55
  subject TEXT,
56
  message TEXT,
57
+ consent INTEGER NOT NULL,
58
+ policyVersion INTEGER NOT NULL
59
  )`,
60
  purchases: `CREATE TABLE IF NOT EXISTS purchases (
61
  id INTEGER PRIMARY KEY AUTOINCREMENT,
 
66
  phone TEXT,
67
  product TEXT,
68
  subscription_plan TEXT,
69
+ subscription_type TEXT,
70
+ consent INTEGER NOT NULL,
71
+ policyVersion INTEGER NOT NULL
72
  )`,
73
  jobs: `CREATE TABLE IF NOT EXISTS jobs (
74
  id INTEGER PRIMARY KEY AUTOINCREMENT,
frontend/src/sections/contact/Forms.jsx CHANGED
@@ -3,6 +3,7 @@ import styled from 'styled-components';
3
  import IntlTelInput from "intl-tel-input/reactWithUtils";
4
  import "intl-tel-input/build/css/intlTelInput.css";
5
  import axios from 'axios';
 
6
  import { showCustomAlert, showCustomError, showCustomSuccess } from '../../utils/showalerts';
7
 
8
  import { DateTime } from 'luxon';
@@ -229,10 +230,13 @@ const ContactForm = ({ formType, demoProduct }) => {
229
  return;
230
  }
231
 
 
 
 
232
  let formData =
233
  formType === 'general'
234
- ? { name, email, phone, subject, message, consent }
235
- : { name, email, phone, company, product, demoDate, selectedSlot, additionalComments, timezone, consent };
236
 
237
  // Validate required fields
238
  // if(formType === 'general' && (!name || !email || !phone || !subject || !message) ){
 
3
  import IntlTelInput from "intl-tel-input/reactWithUtils";
4
  import "intl-tel-input/build/css/intlTelInput.css";
5
  import axios from 'axios';
6
+ import privacyPolicyData from "../../data/privacyPolicyData";
7
  import { showCustomAlert, showCustomError, showCustomSuccess } from '../../utils/showalerts';
8
 
9
  import { DateTime } from 'luxon';
 
230
  return;
231
  }
232
 
233
+ //Set the policy version number
234
+ const policyVersion = privacyPolicyData.version;
235
+
236
  let formData =
237
  formType === 'general'
238
+ ? { name, email, phone, subject, message, consent, policyVersion}
239
+ : { name, email, phone, company, product, demoDate, selectedSlot, additionalComments, timezone, consent, policyVersion};
240
 
241
  // Validate required fields
242
  // if(formType === 'general' && (!name || !email || !phone || !subject || !message) ){
frontend/src/sections/jobs/JobPageSection.jsx CHANGED
@@ -5,6 +5,7 @@ import { createGlobalStyle } from 'styled-components';
5
  import IntlTelInput from 'intl-tel-input/reactWithUtils';
6
  import 'intl-tel-input/styles';
7
  import axios from 'axios';
 
8
  import { showCustomAlert, showCustomError, showCustomSuccess } from '../../utils/showalerts';
9
 
10
  const GlobalStyles = createGlobalStyle`
@@ -301,6 +302,9 @@ const JobPageSection = ({ job }) => {
301
  showCustomError("Please enter a valid phone number.");
302
  return;
303
  }
 
 
 
304
 
305
  try {
306
  const formData = new FormData();
@@ -310,6 +314,7 @@ const JobPageSection = ({ job }) => {
310
  formData.append('experience', experience);
311
  formData.append('linkedin', linkedin);
312
  formData.append('consent', consent);
 
313
  formData.append('role', role); // Add role to the form data
314
  formData.append('resume', document.getElementById('fileInput').files[0]);
315
 
 
5
  import IntlTelInput from 'intl-tel-input/reactWithUtils';
6
  import 'intl-tel-input/styles';
7
  import axios from 'axios';
8
+ import privacyPolicyData from "../../data/privacyPolicyData";
9
  import { showCustomAlert, showCustomError, showCustomSuccess } from '../../utils/showalerts';
10
 
11
  const GlobalStyles = createGlobalStyle`
 
302
  showCustomError("Please enter a valid phone number.");
303
  return;
304
  }
305
+
306
+ //Set the policy version number
307
+ const policyVersion = privacyPolicyData.version;
308
 
309
  try {
310
  const formData = new FormData();
 
314
  formData.append('experience', experience);
315
  formData.append('linkedin', linkedin);
316
  formData.append('consent', consent);
317
+ formData.append('policyVersion', policyVersion);
318
  formData.append('role', role); // Add role to the form data
319
  formData.append('resume', document.getElementById('fileInput').files[0]);
320