Added notifications

Added shopping cart and items
Added quotes
Refactored relatinoships
Migrated changes
Refactored cqrs commands and queries
Refactored mappings
This commit is contained in:
Khwezi Mngoma
2026-05-05 23:59:31 +02:00
parent 4b822c63b2
commit 83f51c6a23
67 changed files with 3051 additions and 42 deletions
@@ -0,0 +1,26 @@
using LiteCharms.Extensions;
using LiteCharms.Infrastructure.Database;
using LiteCharms.Models;
namespace LiteCharms.Features.Refunds.Queries.Handlers;
public class GetRefundQueryHandler(IDbContextFactory<LeadGeneratorDbContext> contextFactory) : IRequestHandler<GetRefundQuery, Result<OrderRefund>>
{
public async ValueTask<Result<OrderRefund>> Handle(GetRefundQuery request, CancellationToken cancellationToken)
{
try
{
using var context = await contextFactory.CreateDbContextAsync(cancellationToken);
var refund = await context.OrderRefunds.AsNoTracking().FirstOrDefaultAsync(r => r.Id == request.OrderRefundId, cancellationToken);
return refund is not null
? Result.Ok(refund.ToModel())
: Result.Fail<OrderRefund>($"Order refund could not be found with id {request.OrderRefundId}");
}
catch (Exception ex)
{
return Result.Fail<OrderRefund>(new Error(ex.Message).CausedBy(ex));
}
}
}