yessir
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
using Svrnty.CQRS.Abstractions;
|
||||
|
||||
namespace Svrnty.Sample;
|
||||
|
||||
public record User
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public string Email { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public record FetchUserQuery
|
||||
{
|
||||
public int UserId { get; set; }
|
||||
}
|
||||
|
||||
public class FetchUserQueryHandler : IQueryHandler<FetchUserQuery, User>
|
||||
{
|
||||
public Task<User> HandleAsync(FetchUserQuery query, CancellationToken cancellationToken = default)
|
||||
{
|
||||
// Simulate fetching a user
|
||||
return Task.FromResult(new User
|
||||
{
|
||||
Id = query.UserId,
|
||||
Name = "John Doe",
|
||||
Email = "john@example.com"
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user