backend: Rename participants.routes.ts to participant.routes.ts for consistency

This commit is contained in:
juancarmore 2025-04-12 12:37:25 +02:00
parent ef67924fbc
commit 9ccda10c6e
3 changed files with 13 additions and 14 deletions

View File

@ -3,3 +3,4 @@ export * from './global-preferences.routes.js';
export * from './room.routes.js'; export * from './room.routes.js';
export * from './auth.routes.js'; export * from './auth.routes.js';
export * from './livekit.routes.js'; export * from './livekit.routes.js';
export * from './participant.routes.js';

View File

@ -8,24 +8,24 @@ import {
import { configureTokenAuth, withModeratorPermissions } from '../middlewares/participant.middleware.js'; import { configureTokenAuth, withModeratorPermissions } from '../middlewares/participant.middleware.js';
import { participantTokenValidator, withAuth } from '../middlewares/auth.middleware.js'; import { participantTokenValidator, withAuth } from '../middlewares/auth.middleware.js';
export const internalParticipantsRouter = Router(); export const internalParticipantRouter = Router();
internalParticipantsRouter.use(bodyParser.urlencoded({ extended: true })); internalParticipantRouter.use(bodyParser.urlencoded({ extended: true }));
internalParticipantsRouter.use(bodyParser.json()); internalParticipantRouter.use(bodyParser.json());
// Internal Participant Routes // Internal Participant Routes
internalParticipantsRouter.post( internalParticipantRouter.post(
'/token', '/token',
validateParticipantTokenRequest, validateParticipantTokenRequest,
configureTokenAuth, configureTokenAuth,
participantCtrl.generateParticipantToken participantCtrl.generateParticipantToken
); );
internalParticipantsRouter.post( internalParticipantRouter.post(
'/token/refresh', '/token/refresh',
validateParticipantTokenRequest, validateParticipantTokenRequest,
configureTokenAuth, configureTokenAuth,
participantCtrl.refreshParticipantToken participantCtrl.refreshParticipantToken
); );
internalParticipantsRouter.delete( internalParticipantRouter.delete(
'/:participantName', '/:participantName',
withAuth(participantTokenValidator), withAuth(participantTokenValidator),
validateParticipantDeletionRequest, validateParticipantDeletionRequest,

View File

@ -2,11 +2,7 @@ import express, { Request, Response, Express } from 'express';
import cors from 'cors'; import cors from 'cors';
import chalk from 'chalk'; import chalk from 'chalk';
import { registerDependencies, initializeEagerServices } from './config/dependency-injector.config.js'; import { registerDependencies, initializeEagerServices } from './config/dependency-injector.config.js';
import { import { SERVER_PORT, SERVER_CORS_ORIGIN, logEnvVars } from './environment.js';
SERVER_PORT,
SERVER_CORS_ORIGIN,
logEnvVars,
} from './environment.js';
import { import {
publicApiHtmlFilePath, publicApiHtmlFilePath,
indexHtmlPath, indexHtmlPath,
@ -16,6 +12,7 @@ import {
} from './utils/path-utils.js'; } from './utils/path-utils.js';
import { import {
authRouter, authRouter,
internalParticipantRouter,
internalRecordingRouter, internalRecordingRouter,
internalRoomRouter, internalRoomRouter,
livekitWebhookRouter, livekitWebhookRouter,
@ -23,7 +20,6 @@ import {
recordingRouter, recordingRouter,
roomRouter roomRouter
} from './routes/index.js'; } from './routes/index.js';
import { internalParticipantsRouter } from './routes/participants.routes.js';
import cookieParser from 'cookie-parser'; import cookieParser from 'cookie-parser';
import { jsonSyntaxErrorHandler } from './middlewares/content-type.middleware.js'; import { jsonSyntaxErrorHandler } from './middlewares/content-type.middleware.js';
import INTERNAL_CONFIG from './config/internal-config.js'; import INTERNAL_CONFIG from './config/internal-config.js';
@ -48,7 +44,9 @@ const createApp = () => {
app.use(cookieParser()); app.use(cookieParser());
// Public API routes // Public API routes
app.use(`${INTERNAL_CONFIG.API_BASE_PATH_V1}/docs`, (_req: Request, res: Response) => res.sendFile(publicApiHtmlFilePath)); app.use(`${INTERNAL_CONFIG.API_BASE_PATH_V1}/docs`, (_req: Request, res: Response) =>
res.sendFile(publicApiHtmlFilePath)
);
app.use(`${INTERNAL_CONFIG.API_BASE_PATH_V1}/rooms`, /*mediaTypeValidatorMiddleware,*/ roomRouter); app.use(`${INTERNAL_CONFIG.API_BASE_PATH_V1}/rooms`, /*mediaTypeValidatorMiddleware,*/ roomRouter);
app.use(`${INTERNAL_CONFIG.API_BASE_PATH_V1}/recordings`, /*mediaTypeValidatorMiddleware,*/ recordingRouter); app.use(`${INTERNAL_CONFIG.API_BASE_PATH_V1}/recordings`, /*mediaTypeValidatorMiddleware,*/ recordingRouter);
@ -58,7 +56,7 @@ const createApp = () => {
); );
app.use(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/auth`, authRouter); 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}/rooms`, internalRoomRouter);
app.use(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/participants`, internalParticipantsRouter); 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}/recordings`, internalRecordingRouter);
app.use(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/preferences`, preferencesRouter); app.use(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/preferences`, preferencesRouter);