Implement meeting management features: add routes and controllers for… - #4
Merged
Conversation
… creating, joining, scheduling, and managing meetings; include personal room functionality and meeting code generation.
There was a problem hiding this comment.
Pull request overview
This PR introduces backend support for meeting management by adding a Meeting model plus protected API endpoints for creating, joining, scheduling, ending meetings, and supporting “personal room” meetings with generated meeting codes.
Changes:
- Added
/api/meetingsroutes wired into the server. - Implemented meeting controllers for instant/scheduled meetings, history/upcoming queries, ending meetings, and personal room flows.
- Added
MeetingMongoose model and a meeting-code generator utility.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| backend/src/server.js | Registers the new meetings router under /api/meetings. |
| backend/src/routes/meeting.routes.js | Defines the meeting API endpoints and middleware usage. |
| backend/src/models/Meeting.js | Introduces the Meeting schema (meetingCode, host, type, status, participants, timestamps). |
| backend/src/lib/generateMeetingCode.js | Adds meeting code generation helper used by meeting creation/join flows. |
| backend/src/controllers/meeting.controller.js | Implements core meeting business logic for create/join/schedule/history/end/personal room. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+1
to
+9
| const generateMeetingCode = () => { | ||
| const part1 = Math.floor(100 + Math.random() * 900); | ||
| const part2 = Math.floor(100 + Math.random() * 900); | ||
| const part3 = Math.floor(100 + Math.random() * 900); | ||
|
|
||
| return `${part1}-${part2}-${part3}`; //code like this 452-819-671 | ||
| }; | ||
|
|
||
| export default generateMeetingCode; No newline at end of file |
Comment on lines
+1
to
+18
| import express from "express"; | ||
| import { createInstantMeeting , joinMeeting, scheduleMeeting, getUpcommingMeetings, getHistoryMeetings, endMeeting, getPersonalRoom, joinPersonalRoom} from "../controllers/meeting.controller.js"; | ||
| import { protectRoute } from "../middleware/auth.middleware.js"; | ||
|
|
||
| const router = express.Router(); | ||
|
|
||
| router.post("/create", protectRoute, createInstantMeeting); | ||
| router.post("/join", protectRoute, joinMeeting); | ||
| router.post("/schedule", protectRoute, scheduleMeeting); | ||
| router.get("/upcoming", protectRoute, getUpcommingMeetings); | ||
| router.get("/history", protectRoute, getHistoryMeetings); | ||
| router.patch("/:meetingId/end", protectRoute, endMeeting); | ||
|
|
||
| router.get("/personal-room", protectRoute, getPersonalRoom); | ||
| router.post("/personal-room/join", protectRoute, joinPersonalRoom); | ||
|
|
||
|
|
||
| export default router; No newline at end of file |
| @@ -0,0 +1,18 @@ | |||
| import express from "express"; | |||
| import { createInstantMeeting , joinMeeting, scheduleMeeting, getUpcommingMeetings, getHistoryMeetings, endMeeting, getPersonalRoom, joinPersonalRoom} from "../controllers/meeting.controller.js"; | |||
Comment on lines
+45
to
+51
| const { meetingCode } = req.body; | ||
| if (!meetingCode) { | ||
| return res.status(400).json({ | ||
| success: false, | ||
| message: "Meeting code is required", | ||
| }); | ||
| } |
Comment on lines
+61
to
+66
| if (meeting.status === "ended") { | ||
| return res.status(400).json({ | ||
| success: false, | ||
| message: "Meeting has ended", | ||
| }); | ||
| } |
Comment on lines
+316
to
+320
| const { personalRoomId } = req.body; | ||
|
|
||
| const owner = await User.findOne({ | ||
| personalRoomId, | ||
| }); |
Comment on lines
+335
to
+345
| if (!meeting) { | ||
| meeting = await Meeting.create({ | ||
| title: `${owner.fullName}'s Personal Room`, | ||
| meetingCode: generateMeetingCode(), | ||
| host: owner._id, | ||
| meetingType: "personal", | ||
| status: "active", | ||
| participants: [owner._id], | ||
| startedAt: new Date(), | ||
| }); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
… creating, joining, scheduling, and managing meetings; include personal room functionality and meeting code generation.