mirror of
https://github.com/streetwriters/notesnook-sync-server.git
synced 2026-08-12 19:40:47 +02:00
common: send message to subscriptions server on email confirmed
This commit is contained in:
@@ -42,6 +42,20 @@ namespace Streetwriters.Common
|
||||
PackageName = "com.streetwriters.notesnook",
|
||||
OnEmailConfirmed = async (userId) =>
|
||||
{
|
||||
if (!Constants.IS_SELF_HOSTED)
|
||||
{
|
||||
await WampServers.SubscriptionServer.PublishMessageAsync(
|
||||
SubscriptionServerTopics.EmailConfirmedTopic,
|
||||
new EmailConfirmedMessage
|
||||
{
|
||||
UserId = userId,
|
||||
ClientId = "notesnook",
|
||||
AppId = ApplicationType.NOTESNOOK,
|
||||
ConfirmedAt = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
await WampServers.MessengerServer.PublishMessageAsync(MessengerServerTopics.SendSSETopic, new SendSSEMessage
|
||||
{
|
||||
UserId = userId,
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using Streetwriters.Common.Enums;
|
||||
|
||||
namespace Streetwriters.Common.Messages
|
||||
{
|
||||
public class EmailConfirmedMessage
|
||||
{
|
||||
[JsonPropertyName("userId")]
|
||||
public required string UserId { get; set; }
|
||||
|
||||
[JsonPropertyName("clientId")]
|
||||
public required string ClientId { get; set; }
|
||||
|
||||
[JsonPropertyName("appId")]
|
||||
public ApplicationType AppId { get; set; }
|
||||
|
||||
[JsonPropertyName("confirmedAt")]
|
||||
public long ConfirmedAt { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -110,6 +110,7 @@ namespace Streetwriters.Common
|
||||
public const string CreateSubscriptionTopic = "co.streetwriters.subscriptions.create";
|
||||
public const string CreateSubscriptionV2Topic = "co.streetwriters.subscriptions.v2.create";
|
||||
public const string DeleteSubscriptionTopic = "co.streetwriters.subscriptions.delete";
|
||||
public const string EmailConfirmedTopic = "co.streetwriters.subscriptions.email_confirmed";
|
||||
}
|
||||
|
||||
public struct IdentityServerTopics
|
||||
|
||||
Reference in New Issue
Block a user