first commit

This commit is contained in:
Vitalii Litvinchuk
2026-06-13 23:23:50 +03:00
commit 23958e8e2c
72 changed files with 6142 additions and 0 deletions
@@ -0,0 +1,18 @@
using MediatR;
using SequenceAuth.Example.Domain;
using SequenceAuth.Example.Infrastructure;
namespace SequenceAuth.Example.Features.Todos;
public record CreateTodoCommand(Guid UserId, string Title) : IRequest<TodoItem>;
public class CreateTodoCommandHandler(AppDbContext dbContext) : IRequestHandler<CreateTodoCommand, TodoItem>
{
public async Task<TodoItem> Handle(CreateTodoCommand request, CancellationToken cancellationToken)
{
var todo = new TodoItem(Guid.NewGuid(), request.UserId, request.Title, TodoStatus.Pending);
dbContext.Todos.Add(todo);
await dbContext.SaveChangesAsync(cancellationToken);
return todo;
}
}