From cffa8f40c274df7da04acefa527f55226b88bd3e Mon Sep 17 00:00:00 2001 From: Pierre Hubert Date: Fri, 16 Jun 2023 18:47:08 +0200 Subject: [PATCH] Add new TODOs --- geneit_backend/src/services/families_service.rs | 10 ++++++++++ geneit_backend/src/services/users_service.rs | 5 +++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/geneit_backend/src/services/families_service.rs b/geneit_backend/src/services/families_service.rs index c41eaea..597b0bd 100644 --- a/geneit_backend/src/services/families_service.rs +++ b/geneit_backend/src/services/families_service.rs @@ -44,3 +44,13 @@ pub async fn add_member( Ok(res) }) } + +/// Remove a membership to a family +pub async fn remove_membership(family_id: FamilyID, user_id: UserID) { + todo!() +} + +/// Remove all memberships of user +pub async fn remove_all_user_membership(user_id: UserID) -> anyhow::Result<()> { + todo!() +} diff --git a/geneit_backend/src/services/users_service.rs b/geneit_backend/src/services/users_service.rs index b60db33..304a517 100644 --- a/geneit_backend/src/services/users_service.rs +++ b/geneit_backend/src/services/users_service.rs @@ -5,7 +5,7 @@ use crate::connections::db_connection; use crate::constants::{ACCOUNT_DELETE_TOKEN_DURATION, PASSWORD_RESET_TOKEN_DURATION}; use crate::models::{NewUser, User, UserID}; use crate::schema::users; -use crate::services::{login_token_service, mail_service}; +use crate::services::{families_service, login_token_service, mail_service}; use crate::utils::string_utils::rand_str; use crate::utils::time_utils::time; use bcrypt::DEFAULT_COST; @@ -171,7 +171,8 @@ pub async fn delete_not_validated_accounts() -> anyhow::Result<()> { pub async fn delete_account(user: &User) -> anyhow::Result<()> { log::info!("Delete account #{:?}", user.id()); - // TODO : remove families memberships + // Remove families memberships + families_service::remove_all_user_membership(user.id()).await?; login_token_service::disconnect_user_from_all_devices(user.id()).await?;