backend: Update startRecording response to include Location header and change status code to 201
This commit is contained in:
parent
0402f284e7
commit
2207b7651f
@ -9,3 +9,10 @@ content:
|
|||||||
status: 'STARTING'
|
status: 'STARTING'
|
||||||
filename: 'room-123--XX445.mp4'
|
filename: 'room-123--XX445.mp4'
|
||||||
startDate: 1600000000000
|
startDate: 1600000000000
|
||||||
|
headers:
|
||||||
|
Location:
|
||||||
|
description: URL of the newly created recording
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
format: uri
|
||||||
|
example: https://your-api.com/meet/internal-api/v1/recordings/room-123--EG_XYZ--XX445
|
||||||
|
|||||||
@ -11,7 +11,7 @@
|
|||||||
requestBody:
|
requestBody:
|
||||||
$ref: '../../components/requestBodies/start-recording-request.yaml'
|
$ref: '../../components/requestBodies/start-recording-request.yaml'
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'201':
|
||||||
$ref: '../../components/responses/internal/success-start-recording.yaml'
|
$ref: '../../components/responses/internal/success-start-recording.yaml'
|
||||||
'401':
|
'401':
|
||||||
$ref: '../../components/responses/unauthorized-error.yaml'
|
$ref: '../../components/responses/unauthorized-error.yaml'
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import { LoggerService } from '../services/logger.service.js';
|
|||||||
import { OpenViduMeetError } from '../models/error.model.js';
|
import { OpenViduMeetError } from '../models/error.model.js';
|
||||||
import { RecordingService } from '../services/recording.service.js';
|
import { RecordingService } from '../services/recording.service.js';
|
||||||
import { container } from '../config/dependency-injector.config.js';
|
import { container } from '../config/dependency-injector.config.js';
|
||||||
|
import INTERNAL_CONFIG from '../config/internal-config.js';
|
||||||
|
|
||||||
export const startRecording = async (req: Request, res: Response) => {
|
export const startRecording = async (req: Request, res: Response) => {
|
||||||
const logger = container.get(LoggerService);
|
const logger = container.get(LoggerService);
|
||||||
@ -12,7 +13,12 @@ export const startRecording = async (req: Request, res: Response) => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const recordingInfo = await recordingService.startRecording(roomId);
|
const recordingInfo = await recordingService.startRecording(roomId);
|
||||||
return res.status(200).json(recordingInfo);
|
res.setHeader(
|
||||||
|
'Location',
|
||||||
|
`${req.protocol}://${req.get('host')}/${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/recordings/${recordingInfo.recordingId}`
|
||||||
|
);
|
||||||
|
|
||||||
|
return res.status(201).json(recordingInfo);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error instanceof OpenViduMeetError) {
|
if (error instanceof OpenViduMeetError) {
|
||||||
logger.error(`Error starting recording: ${error.message}`);
|
logger.error(`Error starting recording: ${error.message}`);
|
||||||
@ -181,5 +187,4 @@ export const getRecordingMedia = async (req: Request, res: Response) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// Internal Recording methods
|
// Internal Recording methods
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user