Setup etcd helper and magic onion

This commit is contained in:
2025-07-07 22:32:03 +08:00
parent 8d2f4a4c47
commit 0d47716713
11 changed files with 163 additions and 29 deletions

View File

@@ -66,8 +66,8 @@ public class NotificationService(
AccountId = account.Id,
};
// db.NotificationPushSubscriptions.Add(subscription);
// await db.SaveChangesAsync();
db.NotificationPushSubscriptions.Add(subscription);
await db.SaveChangesAsync();
return subscription;
}
@@ -107,7 +107,7 @@ public class NotificationService(
}
if (!isSilent)
Console.WriteLine("Simulating notification delivery."); // _ = DeliveryNotification(notification);
_ = DeliveryNotification(notification);
return notification;
}
@@ -134,10 +134,10 @@ public class NotificationService(
var id = notifications.Where(n => n.ViewedAt == null).Select(n => n.Id).ToList();
if (id.Count == 0) return;
// await db.Notifications
// .Where(n => id.Contains(n.Id))
// .ExecuteUpdateAsync(s => s.SetProperty(n => n.ViewedAt, now)
// );
await db.Notifications
.Where(n => id.Contains(n.Id))
.ExecuteUpdateAsync(s => s.SetProperty(n => n.ViewedAt, now)
);
}
public async Task BroadcastNotification(Notification notification, bool save = false)
@@ -161,7 +161,7 @@ public class NotificationService(
};
return newNotification;
}).ToList();
// await db.BulkInsertAsync(notifications);
await db.BulkInsertAsync(notifications);
}
foreach (var account in accounts)