Account contact can be primary

This commit is contained in:
2025-06-08 19:42:52 +08:00
parent 144b7fcfc2
commit de64f64c0e
5 changed files with 3450 additions and 1 deletions

View File

@ -376,7 +376,8 @@ public class AccountService(
var contact = new AccountContact
{
Type = type,
Content = content
Content = content,
AccountId = account.Id,
};
db.AccountContacts.Add(contact);

View File

@ -66,6 +66,7 @@ public class MagicSpellService(
.Where(c => c.Account.Id == spell.AccountId)
.Where(c => c.Type == AccountContactType.Email)
.Where(c => c.VerifiedAt != null || bypassVerify)
.OrderByDescending(c => c.IsPrimary)
.Include(c => c.Account)
.FirstOrDefaultAsync();
if (contact is null) throw new ArgumentException("Account has no contact method that can use");