feat: pivot to social media workflow app
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
using Socialize.Modules.Notifications.Contracts;
|
||||
using Socialize.Modules.Notifications.Data;
|
||||
|
||||
namespace Socialize.Modules.Notifications.Services;
|
||||
|
||||
public class NotificationEventWriter(
|
||||
AppDbContext dbContext)
|
||||
: INotificationEventWriter
|
||||
{
|
||||
public async Task WriteAsync(NotificationEventWriteModel model, CancellationToken cancellationToken = default)
|
||||
{
|
||||
NotificationEvent notificationEvent = new()
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
WorkspaceId = model.WorkspaceId,
|
||||
ContentItemId = model.ContentItemId,
|
||||
EventType = model.EventType,
|
||||
EntityType = model.EntityType,
|
||||
EntityId = model.EntityId,
|
||||
Message = model.Message,
|
||||
RecipientUserId = model.RecipientUserId,
|
||||
RecipientEmail = model.RecipientEmail,
|
||||
MetadataJson = model.MetadataJson,
|
||||
CreatedAt = DateTimeOffset.UtcNow,
|
||||
};
|
||||
|
||||
dbContext.NotificationEvents.Add(notificationEvent);
|
||||
await dbContext.SaveChangesAsync(cancellationToken);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user