unified code verification service
This commit is contained in:
@@ -73,22 +73,22 @@ func (m *AccountManager) DeleteOrganization(ctx context.Context, orgRef bson.Obj
|
||||
// DeleteAccount deletes an account and all its associated data
|
||||
// The caller is responsible for wrapping this in a transaction
|
||||
func (m *AccountManager) DeleteAccount(ctx context.Context, accountRef bson.ObjectID) error {
|
||||
m.logger.Debug("Deleting account", mzap.ObjRef("account_ref", accountRef))
|
||||
m.logger.Debug("Deleting account", mzap.AccRef(accountRef))
|
||||
|
||||
// Delete the account
|
||||
if err := m.accountDB.Delete(ctx, accountRef); err != nil {
|
||||
m.logger.Warn("Failed to delete account", zap.Error(err), mzap.ObjRef("account_ref", accountRef))
|
||||
m.logger.Warn("Failed to delete account", zap.Error(err), mzap.AccRef(accountRef))
|
||||
return err
|
||||
}
|
||||
|
||||
m.logger.Info("Successfully deleted account", mzap.ObjRef("account_ref", accountRef))
|
||||
m.logger.Info("Successfully deleted account", mzap.AccRef(accountRef))
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeleteAll deletes all data for a given account and organization
|
||||
// The caller is responsible for wrapping this in a transaction
|
||||
func (m *AccountManager) DeleteAll(ctx context.Context, accountRef, organizationRef bson.ObjectID) error {
|
||||
m.logger.Debug("Deleting all data", mzap.ObjRef("account_ref", accountRef), mzap.ObjRef("organization_ref", organizationRef))
|
||||
m.logger.Debug("Deleting all data", mzap.AccRef(accountRef), mzap.ObjRef("organization_ref", organizationRef))
|
||||
|
||||
// Delete organization first (which will cascade delete all related data)
|
||||
if err := m.DeleteOrganization(ctx, organizationRef); err != nil {
|
||||
@@ -98,11 +98,11 @@ func (m *AccountManager) DeleteAll(ctx context.Context, accountRef, organization
|
||||
|
||||
// Delete account
|
||||
if err := m.DeleteAccount(ctx, accountRef); err != nil {
|
||||
m.logger.Warn("Failed to delete account", zap.Error(err), mzap.ObjRef("account_ref", accountRef))
|
||||
m.logger.Warn("Failed to delete account", zap.Error(err), mzap.AccRef(accountRef))
|
||||
return err
|
||||
}
|
||||
|
||||
m.logger.Info("Successfully deleted all data", mzap.ObjRef("account_ref", accountRef), mzap.ObjRef("organization_ref", organizationRef))
|
||||
m.logger.Info("Successfully deleted all data", mzap.AccRef(accountRef), mzap.ObjRef("organization_ref", organizationRef))
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user