@@ -10,29 +10,20 @@ const getDiscussionApiBaseUrl = () => `${getConfig().LMS_BASE_URL}/api/discussio
1010/**
1111 * Soft delete a single thread by calling the DELETE endpoint
1212 * @param {string } threadId - The ID of the thread to soft delete
13- * @param {string } userId - The ID of the user performing the action
14- * @param {string } courseId - The course ID
1513 * @returns {Promise } API response
1614 */
17- export async function softDeleteThread ( threadId , userId , courseId ) {
15+ export async function softDeleteThread ( threadId ) {
1816 const url = `${ getDiscussionApiBaseUrl ( ) } /threads/${ threadId } /` ;
19- console . log ( '[Service] softDeleteThread - About to DELETE:' , url ) ;
20- console . log ( '[Service] LMS_BASE_URL:' , getConfig ( ) . LMS_BASE_URL ) ;
21-
2217 return getAuthenticatedHttpClient ( ) . delete ( url ) ;
2318}
2419
2520/**
2621 * Restore a soft deleted thread
2722 * @param {string } threadId - The ID of the thread to restore
28- * @param {string } courseId - The course ID
2923 * @returns {Promise } API response
3024 */
31- export async function restoreThread ( threadId , courseId ) {
25+ export async function restoreThread ( threadId ) {
3226 const url = `${ getDiscussionApiBaseUrl ( ) } /threads/${ threadId } /restore/` ;
33- console . log ( '[Service] restoreThread - About to POST:' , url ) ;
34- console . log ( '[Service] LMS_BASE_URL:' , getConfig ( ) . LMS_BASE_URL ) ;
35-
3627 return getAuthenticatedHttpClient ( ) . post ( url , { } ) ;
3728}
3829
@@ -41,20 +32,12 @@ export async function restoreThread(threadId, courseId) {
4132 * NOTE: Currently implemented as sequential deletes.
4233 * TODO: Implement true bulk endpoint for better performance
4334 * @param {string[] } threadIds - Array of thread IDs to soft delete
44- * @param {string } userId - The ID of the user performing the action
45- * @param {string } courseId - The course ID
4635 * @returns {Promise } API response
4736 */
48- export async function bulkSoftDeleteThreads ( threadIds , userId , courseId ) {
49- console . log ( '[Service] bulkSoftDeleteThreads called' , { threadIds, userId, courseId } ) ;
50- console . log ( '[Service] Processing' , threadIds . length , 'threads' ) ;
37+ export async function bulkSoftDeleteThreads ( threadIds ) {
5138 const results = await Promise . allSettled (
52- threadIds . map ( threadId => softDeleteThread ( threadId , userId , courseId ) ) ,
39+ threadIds . map ( threadId => softDeleteThread ( threadId ) ) ,
5340 ) ;
54- console . log ( '[Service] bulkSoftDeleteThreads completed' , {
55- successful : results . filter ( r => r . status === 'fulfilled' ) . length ,
56- failed : results . filter ( r => r . status === 'rejected' ) . length ,
57- } ) ;
5841
5942 return {
6043 successful : results . filter ( r => r . status === 'fulfilled' ) . length ,
@@ -68,19 +51,12 @@ export async function bulkSoftDeleteThreads(threadIds, userId, courseId) {
6851 * NOTE: Currently implemented as sequential restores.
6952 * TODO: Implement true bulk endpoint for better performance
7053 * @param {string[] } threadIds - Array of thread IDs to restore
71- * @param {string } courseId - The course ID
7254 * @returns {Promise } API response
7355 */
74- export async function bulkRestoreThreads ( threadIds , courseId ) {
75- console . log ( '[Service] bulkRestoreThreads called' , { threadIds, courseId } ) ;
76- console . log ( '[Service] Processing' , threadIds . length , 'threads' ) ;
56+ export async function bulkRestoreThreads ( threadIds ) {
7757 const results = await Promise . allSettled (
78- threadIds . map ( threadId => restoreThread ( threadId , courseId ) ) ,
58+ threadIds . map ( threadId => restoreThread ( threadId ) ) ,
7959 ) ;
80- console . log ( '[Service] bulkRestoreThreads completed' , {
81- successful : results . filter ( r => r . status === 'fulfilled' ) . length ,
82- failed : results . filter ( r => r . status === 'rejected' ) . length ,
83- } ) ;
8460
8561 return {
8662 successful : results . filter ( r => r . status === 'fulfilled' ) . length ,
@@ -117,17 +93,13 @@ export async function getDeletedThreads(courseId, options = {}) {
11793/**
11894 * Search threads with optional deleted filter
11995 * @param {Object } searchParams - Search parameters including courseId
120- * @param {boolean } includeDeleted - Whether to include deleted threads in search
12196 * @returns {Promise } API response
12297 */
123- export async function searchThreadsWithDeletedFilter ( searchParams , includeDeleted = false ) {
98+ export async function searchThreadsWithDeletedFilter ( searchParams ) {
12499 const url = `${ getDiscussionApiBaseUrl ( ) } /threads/` ;
125100
126101 const params = {
127102 ...searchParams ,
128- // If includeDeleted is false, we'll get only non-deleted threads (default behavior)
129- // If true, we need to handle this differently - perhaps by fetching both and merging
130- // For now, we use the standard thread list endpoint
131103 } ;
132104
133105 return getAuthenticatedHttpClient ( ) . get ( url , { params } ) ;
@@ -136,28 +108,19 @@ export async function searchThreadsWithDeletedFilter(searchParams, includeDelete
136108/**
137109 * Soft delete a single comment by calling the DELETE endpoint
138110 * @param {string } commentId - The ID of the comment to soft delete
139- * @param {string } userId - The ID of the user performing the action
140- * @param {string } courseId - The course ID
141111 * @returns {Promise } API response
142112 */
143- export async function softDeleteComment ( commentId , userId , courseId ) {
113+ export async function softDeleteComment ( commentId ) {
144114 const url = `${ getDiscussionApiBaseUrl ( ) } /comments/${ commentId } /` ;
145- console . log ( '[Service] softDeleteComment - About to DELETE:' , url ) ;
146- console . log ( '[Service] LMS_BASE_URL:' , getConfig ( ) . LMS_BASE_URL ) ;
147-
148115 return getAuthenticatedHttpClient ( ) . delete ( url ) ;
149116}
150117
151118/**
152119 * Restore a soft deleted comment
153120 * @param {string } commentId - The ID of the comment to restore
154- * @param {string } courseId - The course ID
155121 * @returns {Promise } API response
156122 */
157- export async function restoreComment ( commentId , courseId ) {
123+ export async function restoreComment ( commentId ) {
158124 const url = `${ getDiscussionApiBaseUrl ( ) } /comments/${ commentId } /restore/` ;
159- console . log ( '[Service] restoreComment - About to POST:' , url ) ;
160- console . log ( '[Service] LMS_BASE_URL:' , getConfig ( ) . LMS_BASE_URL ) ;
161-
162125 return getAuthenticatedHttpClient ( ) . post ( url , { } ) ;
163126}
0 commit comments