delete static method
Removes the specified auth user.
This also removes all authentication-related entities from all
serverpod_auth_*
packages which are linked to this user, like the
various authentication methods and sessions.
(This is based on the onDelete=Cascade
relationship between the models.
Other packages linking to the AuthUser
may or may not opt into this.)
Throws an AuthUserNotFoundException in case no auth user is found for the ID.
Implementation
static Future<void> delete(
final Session session, {
required final UuidValue authUserId,
final Transaction? transaction,
}) async {
final deletedUsers = await AuthUser.db.deleteWhere(
session,
where: (final t) => t.id.equals(authUserId),
transaction: transaction,
);
if (deletedUsers.isEmpty) {
throw AuthUserNotFoundException();
}
}