Files
yes.blog/Yes.Blog/Endpoints/Admins/Comments/UpdateCommentEndpoint.cs
2025-05-04 22:11:28 +08:00

28 lines
772 B
C#

namespace Yes.Blog.Endpoints.Admins.Comments
{
public class UpdateCommentEndpoint : CommentEndpointScheme, IEndpoint
{
public void Map(IEndpointRouteBuilder app) => app.MapPut("/comments", Handle);
public record Request(int Id);
public class RequestValidator : AbstractValidator<Request>
{
public RequestValidator()
{
}
}
private async Task<IResult> Handle([AsParameters] Request request, IMediator mediator, IMapper mapper, CancellationToken cancellationToken)
{
var command = new UpdateCommentCommand(request.Id);
var response = await mediator.Send(command, cancellationToken);
return Result.Ok(response);
}
}
}