Api v1.15.0 (#1617)

* refactor(chalice): enhanced delete member logic
This commit is contained in:
Kraiem Taha Yassine 2023-11-07 13:48:47 +01:00 committed by GitHub
parent 0682b62770
commit dd2deadee5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 8 deletions

View file

@ -431,14 +431,14 @@ def delete_member(user_id, tenant_id, id_to_delete):
with pg_client.PostgresClient() as cur:
cur.execute(
cur.mogrify(f"""UPDATE public.users
SET deleted_at = timezone('utc'::text, now())
SET deleted_at = timezone('utc'::text, now()),
jwt_iat= NULL, jwt_refresh_jti= NULL,
jwt_refresh_iat= NULL
WHERE user_id=%(user_id)s;""",
{"user_id": id_to_delete}))
cur.execute(
cur.mogrify(f"""UPDATE public.basic_authentication
SET password= NULL, jwt_iat= NULL,
jwt_refresh_jti= NULL, jwt_refresh_iat= NULL,
password= NULL, invitation_token= NULL,
SET password= NULL, invitation_token= NULL,
invited_at= NULL, changed_at= NULL,
change_pwd_expire_at= NULL, change_pwd_token= NULL
WHERE user_id=%(user_id)s;""",

View file

@ -490,14 +490,14 @@ def delete_member(user_id, tenant_id, id_to_delete):
with pg_client.PostgresClient() as cur:
cur.execute(
cur.mogrify(f"""UPDATE public.users
SET deleted_at = timezone('utc'::text, now()), role_id=NULL
SET deleted_at = timezone('utc'::text, now()), role_id=NULL,
jwt_iat= NULL, jwt_refresh_jti= NULL,
jwt_refresh_iat= NULL
WHERE user_id=%(user_id)s AND tenant_id=%(tenant_id)s;""",
{"user_id": id_to_delete, "tenant_id": tenant_id}))
cur.execute(
cur.mogrify(f"""UPDATE public.basic_authentication
SET password=NULL, jwt_iat= NULL,
jwt_refresh_jti= NULL, jwt_refresh_iat= NULL,
password= NULL, invitation_token= NULL,
SET password=NULL, invitation_token= NULL,
invited_at= NULL, changed_at= NULL,
change_pwd_expire_at= NULL, change_pwd_token= NULL
WHERE user_id=%(user_id)s;""",