deleteEmailAccountByAuthUserId method
Future<void>
deleteEmailAccountByAuthUserId(
- Session session, {
- required UuidValue authUserId,
- Transaction? transaction,
Deletes all email accounts by authentication user ID.
This will delete all email authentication accounts for the given auth user ID. Related data such as password reset requests will be automatically deleted due to cascade delete constraints.
Throws an EmailAccountNotFoundException if no accounts exist for the given auth user ID.
Implementation
Future<void> deleteEmailAccountByAuthUserId(
final Session session, {
required final UuidValue authUserId,
final Transaction? transaction,
}) async {
return DatabaseUtil.runInTransactionOrSavepoint(
session.db,
transaction,
(final transaction) async {
final deleted = await _utils.account.deleteAccount(
session,
email: null,
authUserId: authUserId,
transaction: transaction,
);
if (deleted.isEmpty) {
throw EmailAccountNotFoundException();
}
},
);
}