🐛 Fix magic spell and email service

This commit is contained in:
2025-04-29 21:52:35 +08:00
parent 0ebeab672b
commit 35792efa9f
10 changed files with 56 additions and 38 deletions

View File

@ -20,7 +20,7 @@ public class EmailService
public EmailService(IConfiguration configuration)
{
var cfg = configuration.GetValue<EmailServiceConfiguration>("Email");
var cfg = configuration.GetSection("Email").Get<EmailServiceConfiguration>();
_configuration = cfg ?? throw new ArgumentException("Email service was not configured.");
}

View File

@ -44,7 +44,7 @@ public class MagicSpellService(AppDatabase db, EmailService email, ILogger<Magic
if (contact is null) throw new ArgumentException("Account has no contact method that can use");
// TODO replace the baseurl
var link = $"https://api.sn.solsynth.dev/spells/{spell}";
var link = $"https://api.sn.solsynth.dev/spells/{Uri.EscapeDataString(spell.Spell)}";
try
{
@ -102,6 +102,7 @@ public class MagicSpellService(AppDatabase db, EmailService email, ILogger<Magic
});
}
db.Remove(spell);
await db.SaveChangesAsync();
break;
default: