feat(push): add service-owned firebase channels and delivery
Add push contracts, provider delivery and channel diagnostics. Link email channels to services and document migration and validation. Ref: IT-1074
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
namespace HrynCo.NotificationService.Worker.Services.Push;
|
||||
|
||||
using HrynCo.NotificationService.Contracts.Messages;
|
||||
|
||||
public static class PushMessageValidator
|
||||
{
|
||||
public static bool IsValid(SendPushMessage? message)
|
||||
{
|
||||
if (message?.Data is not { } data || message.CorrelationContext is null) return false;
|
||||
return Guid.TryParse(message.CorrelationContext.CorrelationId, out _) &&
|
||||
data.Version == 1 && data.RegistrationId != Guid.Empty && data.BindingId != Guid.Empty &&
|
||||
data.ServiceName is { Length: > 0 and <= 100 } && data.UserId != Guid.Empty &&
|
||||
data.Token is { Length: > 0 and <= 2048 } && data.TokenHash is { Length: 64 } &&
|
||||
data.Title is { Length: > 0 and <= 100 } && data.Body is { Length: > 0 and <= 500 } &&
|
||||
data.Route == "/home" && data.ExpiresAt <= DateTimeOffset.UtcNow.AddMinutes(15);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user