final changes
This commit is contained in:
18
backend/controllers/meetingController.js
Normal file
18
backend/controllers/meetingController.js
Normal file
@@ -0,0 +1,18 @@
|
||||
const Meeting = require("../models/Meeting");
|
||||
|
||||
exports.getMeetings = async (req, res) => {
|
||||
try {
|
||||
const meetings = await Meeting.find();
|
||||
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 };
|
||||
});
|
||||
|
||||
res.json(formattedMeetings);
|
||||
} catch (error) {
|
||||
console.error("Error fetching meetings:", error);
|
||||
res.status(500).json({ error: "Error fetching meetings" });
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user