Added package management
This commit is contained in:
+15
-10
@@ -6,29 +6,34 @@ public class CreateNotificationCommandHandler(IDbContextFactory<ShopDbContext> c
|
||||
{
|
||||
public async ValueTask<Result<Guid>> Handle(CreateNotificationCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
using var context = await contextFactory.CreateDbContextAsync(cancellationToken);
|
||||
|
||||
var newNotification = context.Notifications.Add(new Entities.Notification
|
||||
{
|
||||
Direction = request.Direction,
|
||||
Sender = request.Author,
|
||||
Subject = request.Title,
|
||||
Message = request.Description,
|
||||
SenderName = request.Sender,
|
||||
Sender = request.SenderAddress,
|
||||
Recipient = request.Recipient,
|
||||
RecipientAddress = request.RecipientAddress,
|
||||
Subject = request.Subject,
|
||||
Message = request.Message,
|
||||
Platform = request.Platform,
|
||||
Recipient = request.PlatformAddress,
|
||||
Priority = request.Priority,
|
||||
CorrelationId = request.CorrelationId,
|
||||
CorrelationIdType = request.CorrelationIdType,
|
||||
IsInternal = request.IsInternal,
|
||||
IsHtml = request.IsHtml,
|
||||
Processed = false
|
||||
});
|
||||
|
||||
return newNotification is not null
|
||||
? Result.Ok(newNotification.Entity.Id)
|
||||
return newNotification is not null
|
||||
? Result.Ok(newNotification.Entity.Id)
|
||||
: Result.Fail(new Error("Failed to create notification"));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Result.Fail(new Error(ex.Message).CausedBy(ex));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user