mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2024-12-29 06:58:50 +00:00
Can delete all the likes of a user
This commit is contained in:
parent
7aa0858642
commit
b8e9a4c95d
@ -315,6 +315,9 @@ pub fn delete(user_id: &UserID) -> ResultBoxError {
|
|||||||
// Delete all responses of user to surveys
|
// Delete all responses of user to surveys
|
||||||
survey_helper::delete_all_user_responses(user_id)?;
|
survey_helper::delete_all_user_responses(user_id)?;
|
||||||
|
|
||||||
|
// Delete all the likes created by the user
|
||||||
|
likes_helper::delete_all_user(user_id)?;
|
||||||
|
|
||||||
// TODO : continue work here
|
// TODO : continue work here
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -89,6 +89,13 @@ pub fn export_all_user(user_id: &UserID) -> ResultBoxError<Vec<UserLike>> {
|
|||||||
.exec(db_to_user_like)
|
.exec(db_to_user_like)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Delete all the likes created by a user
|
||||||
|
pub fn delete_all_user(user_id: &UserID) -> ResultBoxError {
|
||||||
|
database::DeleteQuery::new(LIKES_TABLE)
|
||||||
|
.cond_user_id("ID_personne", user_id)
|
||||||
|
.exec()
|
||||||
|
}
|
||||||
|
|
||||||
/// Turn a database entry into a like entry
|
/// Turn a database entry into a like entry
|
||||||
fn db_to_user_like(r: &database::RowResult) -> ResultBoxError<UserLike> {
|
fn db_to_user_like(r: &database::RowResult) -> ResultBoxError<UserLike> {
|
||||||
Ok(UserLike {
|
Ok(UserLike {
|
||||||
|
Loading…
Reference in New Issue
Block a user