Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions PatchNotes.Api/Routes/AdminReadRoutes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ private static void MapWebhookEvents(
.Select(e => new AdminWebhookEventDto
{
EventId = e.EventId,
EventType = e.EventType,
ProcessedAt = e.ProcessedAt,
})
.ToListAsync();
Expand Down Expand Up @@ -333,5 +334,9 @@ public class AdminDigestEmailDto
public class AdminWebhookEventDto
{
public required string EventId { get; set; }

/// <summary>Null for rows recorded before the column existed; it cannot be backfilled.</summary>
public string? EventType { get; set; }

public DateTimeOffset ProcessedAt { get; set; }
}
1 change: 1 addition & 0 deletions PatchNotes.Api/Webhooks/StripeWebhook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ public static WebApplication MapStripeWebhook(this WebApplication app)
db.ProcessedWebhookEvents.Add(new ProcessedWebhookEvent
{
EventId = stripeEvent.Id,
EventType = stripeEvent.Type,
ProcessedAt = DateTimeOffset.UtcNow
});
await db.SaveChangesAsync();
Expand Down
2 changes: 2 additions & 0 deletions PatchNotes.Api/Webhooks/StytchWebhook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ public static WebApplication MapStytchWebhook(this WebApplication app)
db.ProcessedWebhookEvents.Add(new ProcessedWebhookEvent
{
EventId = svixId,
// Stytch splits this across two fields; joined to read like Stripe's dotted types.
EventType = $"{stytchEvent.object_type}.{stytchEvent.action}",
ProcessedAt = DateTimeOffset.UtcNow
});
await db.SaveChangesAsync();
Expand Down
Loading