support PWA notification.
ci-cd-vm / ci-cd (push) Failing after 1m34s

This commit is contained in:
Chris Chen
2026-06-29 22:20:15 -07:00
parent 45d910b554
commit b9210f2501
32 changed files with 1054 additions and 12 deletions
@@ -29,4 +29,12 @@ public class NotificationSetting : AuditableEntity, IAuditable
public bool EnableLine { get; set; }
public string LineChannelAccessToken { get; set; } = "";
public string LineChannelSecret { get; set; } = "";
// ── Web Push (PWA browser notifications) ───────────────────────────────────
// VAPID keys identify this server to the push services. The pair is generated once on first
// startup if empty; the public key is safe to hand to the browser, the private key is a secret.
public bool EnableWebPush { get; set; }
public string VapidPublicKey { get; set; } = "";
public string VapidPrivateKey { get; set; } = "";
public string VapidSubject { get; set; } = ""; // "mailto:..." or the site URL
}
@@ -0,0 +1,33 @@
using ROLAC.API.Entities;
namespace ROLAC.API.Entities.Notifications;
/// <summary>
/// A browser/device Web Push subscription owned by a member. Unlike <see cref="MemberChannelBinding"/>
/// (one external id per channel), web push needs the endpoint URL plus two keys, and a member can
/// have several — one per device/browser they enable notifications on. Targeting a member resolves
/// all of their subscriptions.
/// </summary>
public class WebPushSubscription
{
public int Id { get; set; }
public int MemberId { get; set; }
public Member? Member { get; set; }
/// <summary>The push service endpoint URL (unique per subscription).</summary>
public string Endpoint { get; set; } = null!;
/// <summary>The subscription's P-256 ECDH public key (base64url).</summary>
public string P256dh { get; set; } = null!;
/// <summary>The subscription's auth secret (base64url).</summary>
public string Auth { get; set; } = null!;
/// <summary>The originating user agent, kept for display/debugging.</summary>
public string? UserAgent { get; set; }
public DateTime CreatedAt { get; set; }
/// <summary>Last time a push to this subscription succeeded.</summary>
public DateTime? LastUsedAt { get; set; }
}