backend: Change stop recording endpoint from PUT to POST and update response status to 202

This commit is contained in:
Carlos Santos 2025-04-09 17:12:50 +02:00
parent 9c0607af20
commit e7f45dcbfd
4 changed files with 8 additions and 8 deletions

View File

@ -26,8 +26,8 @@
'500': '500':
$ref: '../../components/responses/internal-server-error.yaml' $ref: '../../components/responses/internal-server-error.yaml'
/recordings/{recordingId}: /recordings/{recordingId}/stop:
put: post:
operationId: stopRecording operationId: stopRecording
summary: Stop a recording summary: Stop a recording
description: > description: >
@ -40,7 +40,7 @@
parameters: parameters:
- $ref: '../../components/parameters/recording-id.yaml' - $ref: '../../components/parameters/recording-id.yaml'
responses: responses:
'200': '202':
$ref: '../../components/responses/success-stop-recording.yaml' $ref: '../../components/responses/success-stop-recording.yaml'
'401': '401':
$ref: '../../components/responses/unauthorized-error.yaml' $ref: '../../components/responses/unauthorized-error.yaml'

View File

@ -95,7 +95,7 @@ export const stopRecording = async (req: Request, res: Response) => {
const recordingInfo = await recordingService.stopRecording(recordingId); const recordingInfo = await recordingService.stopRecording(recordingId);
res.setHeader('Location', `${req.protocol}://${req.get('host')}${req.originalUrl}`); res.setHeader('Location', `${req.protocol}://${req.get('host')}${req.originalUrl}`);
return res.status(200).json(recordingInfo); return res.status(202).json(recordingInfo);
} catch (error) { } catch (error) {
if (error instanceof OpenViduMeetError) { if (error instanceof OpenViduMeetError) {
logger.error(`Error stopping recording: ${error.message}`); logger.error(`Error stopping recording: ${error.message}`);

View File

@ -66,8 +66,8 @@ internalRecordingRouter.post(
recordingCtrl.startRecording recordingCtrl.startRecording
); );
internalRecordingRouter.put( internalRecordingRouter.post(
'/:recordingId', '/:recordingId/stop',
withValidRecordingId, withValidRecordingId,
withRecordingEnabled, withRecordingEnabled,
withAuth(participantTokenValidator), withAuth(participantTokenValidator),

View File

@ -9,7 +9,7 @@ import {
TokenOptions, TokenOptions,
User User
} from '@lib/typings/ce'; } from '@lib/typings/ce';
import { RecordingInfo, Room } from 'openvidu-components-angular'; import { RecordingInfo } from 'openvidu-components-angular';
import { lastValueFrom } from 'rxjs'; import { lastValueFrom } from 'rxjs';
@Injectable({ @Injectable({
@ -124,7 +124,7 @@ export class HttpService {
} }
stopRecording(recordingId: string): Promise<RecordingInfo> { stopRecording(recordingId: string): Promise<RecordingInfo> {
return this.putRequest(`${this.INTERNAL_API_PATH_PREFIX}/${this.API_V1_VERSION}/recordings/${recordingId}`); return this.postRequest(`${this.INTERNAL_API_PATH_PREFIX}/${this.API_V1_VERSION}/recordings/${recordingId}/stop`);
} }
deleteRecording(recordingId: string): Promise<RecordingInfo> { deleteRecording(recordingId: string): Promise<RecordingInfo> {