Initial commit: added frontend and backend

This commit is contained in:
2026-09-22 12:02:38 +05:30
commit cd2770e590
154 changed files with 25892 additions and 0 deletions
+47
View File
@@ -0,0 +1,47 @@
exports.sendOtp = async (req, res) => {
try {
const { phone, name, otpToUse, verificationLink, isExisting } = req.body;
if (!phone || !otpToUse) {
return res.status(400).json({ success: false, message: 'Phone and OTP required' });
}
// Mock WhatsApp API call
console.log(`[WhatsApp Mock] Sending OTP ${otpToUse} to ${phone}`);
console.log(`[WhatsApp Mock] Verification Link: ${verificationLink}`);
// In production, use axios to call the real WhatsApp provider API here.
/*
await axios.post(process.env.WHATSAPP_API_URL, {
to: phone,
type: "template",
template: { ... }
}, {
headers: { 'Authorization': `Bearer ${process.env.WHATSAPP_API_KEY}` }
});
*/
res.json({ success: true, message: 'OTP sent via WhatsApp successfully' });
} catch (error) {
console.error('Error sending WhatsApp OTP:', error);
res.status(500).json({ success: false, message: 'Failed to send OTP' });
}
};
exports.sendReport = async (req, res) => {
try {
const { phone, name, overallScore, origin } = req.body;
if (!phone || overallScore === undefined) {
return res.status(400).json({ success: false, message: 'Phone and overallScore required' });
}
// Mock WhatsApp API call
console.log(`[WhatsApp Mock] Sending Report (Score: ${overallScore}) to ${phone}`);
res.json({ success: true, message: 'Report sent via WhatsApp successfully' });
} catch (error) {
console.error('Error sending WhatsApp Report:', error);
res.status(500).json({ success: false, message: 'Failed to send report' });
}
};