fix comments for update question api
This commit is contained in:
parent
afdc564efc
commit
036f4c4779
@ -113,28 +113,28 @@ pub async fn update_question(
|
||||
match current_tags_option {
|
||||
Some(current_tags) => {
|
||||
let incoming_tag_labels = question.tags;
|
||||
// Create (ignored if they already exist, new tags for the incoming tags)
|
||||
// 3: Create (ignored if they already exist, new tags for the incoming tags)
|
||||
let incoming_tags = store
|
||||
.write()
|
||||
.await
|
||||
.add_tags(incoming_tag_labels)
|
||||
.await
|
||||
.unwrap();
|
||||
// Unassociated all current tags with this question
|
||||
// 4: Unassociated all current tags with this question
|
||||
let _remove_tags = store
|
||||
.write()
|
||||
.await
|
||||
.unassociate_tags(updated_question.id, current_tags)
|
||||
.await
|
||||
.unwrap();
|
||||
// Associated all of the incoming tags (now newly created if needed) with the question
|
||||
// 5: Associated all of the incoming tags (now newly created if needed) with the question
|
||||
let _updated_tags = store
|
||||
.write()
|
||||
.await
|
||||
.associate_tags(updated_question.id, &incoming_tags)
|
||||
.await
|
||||
.unwrap();
|
||||
//Return the updated question with the updated tags
|
||||
//6: Return the updated question with the updated tags
|
||||
QuestionDTO::new(updated_question, incoming_tags).into_response()
|
||||
}
|
||||
None => (StatusCode::OK).into_response(),
|
||||
|
Reference in New Issue
Block a user