@ -728,3 +728,48 @@ class CourseLiveSessionRecordedFileAPIView(GenericAPIView):
' file_time ' : recording . file_time ,
' is_active ' : recording . is_active ,
} , status = status . HTTP_201_CREATED )
class CourseLiveSessionSetRecordingTitleAPIView ( GenericAPIView ) :
permission_classes = [ IsAuthenticated ]
authentication_classes = [ TokenAuthentication ]
@swagger_auto_schema (
operation_description = " Set the recording title for the active live session " ,
tags = [ " Imam-Javad - Course " ] ,
request_body = openapi . Schema (
type = openapi . TYPE_OBJECT ,
required = [ ' room_id ' , ' title ' ] ,
properties = {
' room_id ' : openapi . Schema ( type = openapi . TYPE_STRING , description = ' Room ID ' ) ,
' title ' : openapi . Schema ( type = openapi . TYPE_STRING , description = ' Custom Recording Title ' ) ,
}
) ,
responses = {
200 : openapi . Response (
description = " Recording title updated successfully "
)
}
)
def post ( self , request , * args , * * kwargs ) :
room_id = request . data . get ( ' room_id ' )
title = request . data . get ( ' title ' )
if not room_id or not title :
raise AppAPIException ( { ' message ' : ' room_id and title are required. ' } , status_code = status . HTTP_400_BAD_REQUEST )
try :
session = CourseLiveSession . objects . get ( room_id = room_id , ended_at__isnull = True )
except CourseLiveSession . DoesNotExist :
raise AppAPIException ( { ' message ' : ' Active session not found. ' } , status_code = status . HTTP_404_NOT_FOUND )
# Check if user has permission to manage course associated with session
if not request . user . can_manage_course ( session . course ) :
raise AppAPIException ( { ' message ' : ' Permission denied. ' } , status_code = status . HTTP_403_FORBIDDEN )
session . recording_title = title . strip ( )
session . save ( update_fields = [ ' recording_title ' , ' updated_at ' ] )
logger . info ( f " [LiveSession Title] Set recording title for room_id={room_id} to ' {title} ' " )
return Response ( { ' success ' : True , ' message ' : ' Recording title updated successfully. ' } , status = status . HTTP_200_OK )