@@ -105,7 +105,7 @@ const joinCourse = async (ctx: Context) => {
105105
106106 const profile = await loadProfile ( ctx )
107107 const result = await courseService . updateCourseMember (
108- course . id , profile . id ,
108+ course . _id , profile . _id ,
109109 { ...role , basic : true } ,
110110 )
111111
@@ -166,7 +166,7 @@ const findCourseMembers = async (ctx: Context) => {
166166 const { page, pageSize } = parsePaginateOption ( opt , 30 , 200 )
167167
168168 const response : Paginated < CourseMemberView >
169- = await courseService . findCourseMembers ( course . id , { page, pageSize } )
169+ = await courseService . findCourseMembers ( course . _id , { page, pageSize } )
170170 ctx . body = response
171171}
172172
@@ -181,7 +181,7 @@ const getCourseMember = async (ctx: Context) => {
181181 return ctx . throw ( 400 , 'Missing uid' )
182182 }
183183
184- const member = await courseService . getCourseMember ( course . id , userId )
184+ const member = await courseService . getCourseMember ( course . _id , userId )
185185 if ( ! member ) {
186186 return ctx . throw ( ...ERR_NOT_FOUND )
187187 }
@@ -227,8 +227,8 @@ const updateCourseMember = async (ctx: Context) => {
227227 }
228228
229229 const result = await courseService . updateCourseMember (
230- course . id ,
231- user . id ,
230+ course . _id ,
231+ user . _id ,
232232 newRole as CourseRole ,
233233 )
234234 ctx . auditLog . info ( `<Course:${ course . courseId } > member <User:${ userId } > updated by <User:${ profile . uid } >` )
@@ -251,7 +251,7 @@ const removeCourseMember = async (ctx: Context) => {
251251 return ctx . throw ( 400 , 'Cannot remove yourself from the course' )
252252 }
253253
254- const result = await courseService . removeCourseMember ( course . id , userId )
254+ const result = await courseService . removeCourseMember ( course . _id , userId )
255255 const response : { success : boolean } = { success : result }
256256 ctx . auditLog . info ( `<Course:${ course . courseId } > member <User:${ userId } > removed by <User:${ profile . uid } >` )
257257 ctx . body = response
@@ -269,7 +269,7 @@ const addCourseProblems = async (ctx: Context) => {
269269 if ( ! problem ) {
270270 return false
271271 }
272- return await courseService . addCourseProblem ( course . id , problem . id )
272+ return await courseService . addCourseProblem ( course . _id , problem . _id )
273273 } ) )
274274
275275 const successCount = result . filter ( v => v ) . length
@@ -291,15 +291,15 @@ const moveCourseProblem = async (ctx: Context) => {
291291 return ctx . throw ( ...ERR_INVALID_ID )
292292 }
293293 const result = await courseService . moveCourseProblem (
294- course . id , problem . id , beforePos ,
294+ course . _id , problem . _id , beforePos ,
295295 )
296296 ctx . body = { success : result }
297297}
298298
299299const rearrangeCourseProblem = async ( ctx : Context ) => {
300300 const { course } = await loadCourse ( ctx )
301301 try {
302- await courseService . rearrangeCourseProblem ( course . id )
302+ await courseService . rearrangeCourseProblem ( course . _id )
303303 ctx . body = { success : true }
304304 } catch ( e : any ) {
305305 ctx . throw ( 500 , `Failed to rearrange course problems: ${ e . message } ` )
@@ -313,7 +313,7 @@ const removeCourseProblem = async (ctx: Context) => {
313313 if ( ! problem ) {
314314 return ctx . throw ( ...ERR_INVALID_ID )
315315 }
316- const result = await courseService . removeCourseProblem ( course . id , problem . id )
316+ const result = await courseService . removeCourseProblem ( course . _id , problem . _id )
317317 const profile = await loadProfile ( ctx )
318318 ctx . auditLog . info ( `<Course:${ course . courseId } > removed <Problem:${ problemId } > by <User:${ profile . uid } >` )
319319 ctx . body = { success : result }
0 commit comments