Added package management

This commit is contained in:
Khwezi Mngoma
2026-05-10 14:18:56 +02:00
parent 32d1019eb5
commit 394429677e
29 changed files with 765 additions and 35 deletions
@@ -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));
}
}