Migrated database changes after refactoring the Notification model

This commit is contained in:
Khwezi Mngoma
2026-05-10 15:27:26 +02:00
parent 394429677e
commit e8e9a85c57
20 changed files with 244 additions and 777 deletions
@@ -0,0 +1,16 @@
namespace LiteCharms.Features.Utilities.Hash.Commands;
public class ComputeHashCommand : IRequest<Result<string>>
{
public string? Input { get; set; }
private ComputeHashCommand(string input) => Input = input;
public static ComputeHashCommand Create(string input)
{
if(string.IsNullOrWhiteSpace(input))
throw new ArgumentException("Input is required", nameof(input));
return new(input);
}
}
@@ -0,0 +1,20 @@
using LiteCharms.Features.Utilities.Hash.Commands;
namespace LiteCharms.Features.Utilities.Hash.Commands.Handlers;
public class ComputeHashCommandHandler : IRequestHandler<ComputeHashCommand, Result<string>>
{
public async ValueTask<Result<string>> Handle(ComputeHashCommand request, CancellationToken cancellationToken)
{
try
{
var bytes = SHA256.HashData(Encoding.UTF8.GetBytes(request.Input!));
return Result.Ok(Convert.ToHexString(bytes));
}
catch (Exception ex)
{
return Result.Fail<string>(new Error(ex.Message).CausedBy(ex));
}
}
}