mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2024-11-30 01:06:27 +00:00
Can delete all responses to survey of a user
This commit is contained in:
parent
ffbb81bade
commit
7aa0858642
@ -312,6 +312,9 @@ pub fn delete(user_id: &UserID) -> ResultBoxError {
|
|||||||
// Delete all user posts
|
// Delete all user posts
|
||||||
posts_helper::delete_all_user(user_id)?;
|
posts_helper::delete_all_user(user_id)?;
|
||||||
|
|
||||||
|
// Delete all responses of user to surveys
|
||||||
|
survey_helper::delete_all_user_responses(user_id)?;
|
||||||
|
|
||||||
// TODO : continue work here
|
// TODO : continue work here
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -143,6 +143,13 @@ pub fn export_all_user_responses(user_id: &UserID) -> ResultBoxError<Vec<SurveyR
|
|||||||
.exec(db_to_survey_response)
|
.exec(db_to_survey_response)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Delete all the responses of a user to surveys
|
||||||
|
pub fn delete_all_user_responses(user_id: &UserID) -> ResultBoxError {
|
||||||
|
database::DeleteQuery::new(SURVEY_RESPONSE_TABLE)
|
||||||
|
.cond_user_id("ID_utilisateurs", user_id)
|
||||||
|
.exec()
|
||||||
|
}
|
||||||
|
|
||||||
/// Turn a database entry into a row object
|
/// Turn a database entry into a row object
|
||||||
fn db_to_survey(row: &database::RowResult) -> ResultBoxError<Survey> {
|
fn db_to_survey(row: &database::RowResult) -> ResultBoxError<Survey> {
|
||||||
let survey_id = row.get_u64("ID")?;
|
let survey_id = row.get_u64("ID")?;
|
||||||
|
Loading…
Reference in New Issue
Block a user