backend: Change stop recording endpoint from PUT to POST and update response status to 202
This commit is contained in:
parent
9c0607af20
commit
e7f45dcbfd
@ -26,8 +26,8 @@
|
||||
'500':
|
||||
$ref: '../../components/responses/internal-server-error.yaml'
|
||||
|
||||
/recordings/{recordingId}:
|
||||
put:
|
||||
/recordings/{recordingId}/stop:
|
||||
post:
|
||||
operationId: stopRecording
|
||||
summary: Stop a recording
|
||||
description: >
|
||||
@ -40,7 +40,7 @@
|
||||
parameters:
|
||||
- $ref: '../../components/parameters/recording-id.yaml'
|
||||
responses:
|
||||
'200':
|
||||
'202':
|
||||
$ref: '../../components/responses/success-stop-recording.yaml'
|
||||
'401':
|
||||
$ref: '../../components/responses/unauthorized-error.yaml'
|
||||
|
||||
@ -95,7 +95,7 @@ export const stopRecording = async (req: Request, res: Response) => {
|
||||
|
||||
const recordingInfo = await recordingService.stopRecording(recordingId);
|
||||
res.setHeader('Location', `${req.protocol}://${req.get('host')}${req.originalUrl}`);
|
||||
return res.status(200).json(recordingInfo);
|
||||
return res.status(202).json(recordingInfo);
|
||||
} catch (error) {
|
||||
if (error instanceof OpenViduMeetError) {
|
||||
logger.error(`Error stopping recording: ${error.message}`);
|
||||
|
||||
@ -66,8 +66,8 @@ internalRecordingRouter.post(
|
||||
recordingCtrl.startRecording
|
||||
);
|
||||
|
||||
internalRecordingRouter.put(
|
||||
'/:recordingId',
|
||||
internalRecordingRouter.post(
|
||||
'/:recordingId/stop',
|
||||
withValidRecordingId,
|
||||
withRecordingEnabled,
|
||||
withAuth(participantTokenValidator),
|
||||
|
||||
@ -9,7 +9,7 @@ import {
|
||||
TokenOptions,
|
||||
User
|
||||
} from '@lib/typings/ce';
|
||||
import { RecordingInfo, Room } from 'openvidu-components-angular';
|
||||
import { RecordingInfo } from 'openvidu-components-angular';
|
||||
import { lastValueFrom } from 'rxjs';
|
||||
|
||||
@Injectable({
|
||||
@ -124,7 +124,7 @@ export class HttpService {
|
||||
}
|
||||
|
||||
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> {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user