Implementation of email code and in app code

This commit is contained in:
2025-06-07 02:16:13 +08:00
parent 3c123be6a7
commit af39694be6
11 changed files with 286 additions and 17 deletions

View File

@ -67,13 +67,12 @@ public class NotificationService(
string? subtitle = null,
string? content = null,
Dictionary<string, object>? meta = null,
bool isSilent = false
bool isSilent = false,
bool save = true
)
{
if (title is null && subtitle is null && content is null)
{
throw new ArgumentException("Unable to send notification that completely empty.");
}
var notification = new Notification
{
@ -85,8 +84,11 @@ public class NotificationService(
AccountId = account.Id,
};
db.Add(notification);
await db.SaveChangesAsync();
if (save)
{
db.Add(notification);
await db.SaveChangesAsync();
}
if (!isSilent) _ = DeliveryNotification(notification);