File tree 1 file changed +12
-3
lines changed
1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -23,13 +23,13 @@ class QuizController extends BaseController {
23
23
const questionsToAdd = R . difference ( questions , oldQuestions )
24
24
const questionToRemove = R . difference ( oldQuestions , questions )
25
25
26
- await quiz . addQuestions ( questionsToAdd , {
26
+ const addQuestions = quiz . addQuestions ( questionsToAdd , {
27
27
through : {
28
28
updatedById : req . user . id
29
29
}
30
30
} )
31
31
32
- await DB . quizQuestions . destroy ( {
32
+ const removeQuestions = DB . quizQuestions . destroy ( {
33
33
where :{
34
34
quizId : quiz . id ,
35
35
questionId : {
@@ -38,7 +38,16 @@ class QuizController extends BaseController {
38
38
}
39
39
} )
40
40
41
- super . handleUpdateById ( ...arguments )
41
+ const setUpdatedBy = DB . quizQuestions . update ( {
42
+ updatedById : req . user . id
43
+ } , {
44
+ where : {
45
+ quizId : quiz . id
46
+ }
47
+ } )
48
+
49
+ await Promise . all ( [ addQuestions , removeQuestions , setUpdatedBy ] )
50
+ return super . handleUpdateById ( ...arguments )
42
51
}
43
52
44
53
// body : {
You can’t perform that action at this time.
0 commit comments