Update server and frontend files, add new uploads

This commit is contained in:
sanikapendurkar
2025-02-17 14:40:11 +05:30
parent 0f4e1a3183
commit 56bbb4596f
20 changed files with 82109 additions and 13 deletions

View File

@@ -46,11 +46,32 @@ const meetingSchema = new mongoose.Schema({
});
const Meeting = mongoose.model("Meeting", meetingSchema);
app.get("/api/meetings", async (req, res) => {
try {
const meetings = await Meeting.find(); // Fetching all meetings
// Format agenda in HTML for each meeting
const formattedMeetings = meetings.map((meeting) => {
const formattedAgenda = meeting.agenda
? meeting.agenda.map((item, index) => `<li>${index + 1}. ${item}</li>`).join("")
: "<li>No agenda provided</li>";
return { ...meeting.toObject(), formattedAgenda }; // Add formatted agenda to each meeting
});
res.json(formattedMeetings); // Send formatted meetings
} catch (error) {
console.error("Error fetching meetings:", error);
res.status(500).json({ error: "Error fetching meetings" });
}
});
// API to send email
app.post("/api/send-email", upload.array("attachments"), async (req, res) => {
try {
const { program, department, subject, body, agenda, date, startTime, endTime, recipients } = req.body;
const files = req.files;
console.log({ program, department, subject, body, agenda, date, startTime, endTime, recipients, files });
if (!program || !department || !subject || !body || !date || !startTime || !endTime || !recipients) {
return res.status(400).json({ error: "All fields are required!" });

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long