MCPcopy Create free account
hub / github.com/Bitbox-Connect/Bitbox / submitFeedback

Function submitFeedback

server/Controllers/Feedback.js:4–42  ·  view source on GitHub ↗
(req, res)

Source from the content-addressed store, hash-verified

2const { sendMailToAdmin } = require('../sendFeedbackToAdmin');
3
4const submitFeedback = async (req, res) => {
5 // Extract data from the request body
6 const {
7 Name,
8 Email,
9 Subject,
10 Date, // Correctly match the field from frontend
11 Device, // Correctly match the field from frontend
12 Priority, // Correctly match the field from frontend
13 Suggestions,
14 Feedback,
15 Rating
16 } = req.body;
17
18
19 const feedbackData = {
20 name: Name,
21 email: Email,
22 subject: Subject,
23 dateOfVisit: Date, // Match the frontend field
24 deviceUsed: Device, // Match the frontend field
25 priorityLevel: Priority, // Match the frontend field
26 suggestions: Suggestions,
27 feedback: Feedback,
28 rating: Rating,
29 };
30
31 sendMailToAdmin(feedbackData)
32
33
34 try {
35 const feed = new FeedbackForm(feedbackData);
36 await feed.save();
37 res.status(200).json({ status: 200, message: 'feedback form submitted successfully.' });
38 } catch (error) {
39 console.error("Error in submitting feedback form:", error);
40 res.status(500).json({ error: "Feedback form not submitted successfully." });
41 }
42};
43
44module.exports = {
45 submitFeedback,

Callers

nothing calls this directly

Calls 1

sendMailToAdminFunction · 0.50

Tested by

no test coverage detected