Skip to content

Commit

Permalink
Add template analytics events
Browse files Browse the repository at this point in the history
  • Loading branch information
Bardin08 committed May 20, 2024
1 parent c245158 commit 67ea836
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Trumpee.MassTransit.Messages/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.idea
[bB]in
[oO]bj
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
namespace Trumpee.MassTransit.Messages.Notifications.Template;

public class TemplateFilledEvent : Event<TemplateFilledPayload>
{
public static TemplateFilledEvent GetEvent(
string source, string templateId, string notificationId)
{
return new TemplateFilledEvent
{
Id = Guid.NewGuid().ToString("N"),
Action = nameof(TemplateNotFilledEvent).ToLower(),
Source = source,
Timestamp = DateTimeOffset.UtcNow,
Metadata = [],
Payload = new TemplateFilledPayload
{
TemplateId = templateId,
NotificationId = notificationId
}
};
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace Trumpee.MassTransit.Messages.Notifications.Template;

public class TemplateFilledPayload
{
public required string TemplateId { get; set; }
public required string NotificationId { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
namespace Trumpee.MassTransit.Messages.Notifications.Template;

public class TemplateNotFilledEvent : Event<TemplateNotFilledPayload>
{
public static TemplateNotFilledEvent GetEvent(
string source, string templateId, string notificationId)
{
return new TemplateNotFilledEvent
{
Id = Guid.NewGuid().ToString("N"),
Action = nameof(TemplateNotFilledEvent).ToLower(),
Source = source,
Timestamp = DateTimeOffset.UtcNow,
Metadata = [],
Payload = new TemplateNotFilledPayload
{
TemplateId = templateId,
NotificationId = notificationId
}
};
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace Trumpee.MassTransit.Messages.Notifications.Template;

public class TemplateNotFilledPayload
{
public required string TemplateId { get; set; }
public required string NotificationId { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
namespace Trumpee.MassTransit.Messages.Notifications.Template;

public class TemplateNotFoundEvent : Event<TemplateNotFoundPayload>
{
public static TemplateNotFoundEvent GetEvent(string source, string templateId, Dictionary<string, string> props)
{
return new TemplateNotFoundEvent
{
Id = Guid.NewGuid().ToString("N"),
Action = nameof(TemplateNotFoundEvent).ToLower(),
Source = source,
Timestamp = DateTimeOffset.UtcNow,
Metadata = [],
Payload = new TemplateNotFoundPayload
{
TemplateId = templateId,
Properties = props
}
};
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace Trumpee.MassTransit.Messages.Notifications.Template;

public class TemplateNotFoundPayload
{
public required string TemplateId { get; set; }
public Dictionary<string, string>? Properties { get; set; }
}

0 comments on commit 67ea836

Please sign in to comment.