fix: couple session deletion with user deletion

This commit is contained in:
Lakhan Samani
2022-07-12 08:42:32 +05:30
parent 1fe0d65874
commit bfbeb6add2
11 changed files with 32 additions and 55 deletions

View File

@@ -57,6 +57,12 @@ func (p *provider) DeleteUser(ctx context.Context, user models.User) error {
return err
}
sessionCollection := p.db.Collection(models.Collections.Session, options.Collection())
_, err = sessionCollection.DeleteMany(ctx, bson.M{"user_id": user.ID}, options.Delete())
if err != nil {
return err
}
return nil
}