diff --git a/backend/src/controllers/participant.controller.ts b/backend/src/controllers/participant.controller.ts index aea231a..567b4a0 100644 --- a/backend/src/controllers/participant.controller.ts +++ b/backend/src/controllers/participant.controller.ts @@ -69,8 +69,7 @@ export const refreshParticipantToken = async (req: Request, res: Response) => { export const deleteParticipant = async (req: Request, res: Response) => { const logger = container.get(LoggerService); const participantService = container.get(ParticipantService); - const { participantName } = req.params; - const roomId: string = req.query.roomId as string; + const { roomId, participantName } = req.params; try { await participantService.deleteParticipant(participantName, roomId); diff --git a/backend/src/routes/index.ts b/backend/src/routes/index.ts index 7afb625..e633167 100644 --- a/backend/src/routes/index.ts +++ b/backend/src/routes/index.ts @@ -4,3 +4,4 @@ export * from './room.routes.js'; export * from './auth.routes.js'; export * from './livekit.routes.js'; export * from './participant.routes.js'; +export * from './meeting.routes.js'; diff --git a/backend/src/routes/meeting.routes.ts b/backend/src/routes/meeting.routes.ts new file mode 100644 index 0000000..6efe2cd --- /dev/null +++ b/backend/src/routes/meeting.routes.ts @@ -0,0 +1,23 @@ +import { Router } from 'express'; +import bodyParser from 'body-parser'; +import * as meetingCtrl from '../controllers/meeting.controller.js'; +import * as participantCtrl from '../controllers/participant.controller.js'; +import { withModeratorPermissions, participantTokenValidator, withAuth } from '../middlewares/index.js'; + +export const internalMeetingRouter = Router(); +internalMeetingRouter.use(bodyParser.urlencoded({ extended: true })); +internalMeetingRouter.use(bodyParser.json()); + +// Internal Meetings Routes +internalMeetingRouter.delete( + ':roomId', + withAuth(participantTokenValidator), + withModeratorPermissions, + meetingCtrl.endMeeting +); +internalMeetingRouter.delete( + ':roomId/participants/:participantName', + withAuth(participantTokenValidator), + withModeratorPermissions, + participantCtrl.deleteParticipant +); diff --git a/backend/src/server.ts b/backend/src/server.ts index cd41a4c..845e5b3 100644 --- a/backend/src/server.ts +++ b/backend/src/server.ts @@ -12,6 +12,7 @@ import { } from './utils/path-utils.js'; import { authRouter, + internalMeetingRouter, internalParticipantRouter, internalRecordingRouter, internalRoomRouter, @@ -56,6 +57,7 @@ const createApp = () => { ); app.use(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/auth`, authRouter); app.use(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/rooms`, internalRoomRouter); + app.use(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/meetings`, internalMeetingRouter); app.use(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/participants`, internalParticipantRouter); app.use(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/recordings`, internalRecordingRouter); app.use(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/preferences`, preferencesRouter);