text-matcher/src/Nocr.TextMatcher.Host/Controllers/TextMatchController.cs
Sergey Nazarov 2692f549f4 Add rebus (#1)
Reviewed-on: #1
Co-authored-by: Sergey Nazarov <insight.appdev@gmail.com>
Co-committed-by: Sergey Nazarov <insight.appdev@gmail.com>
2024-03-21 18:57:29 +00:00

28 lines
960 B
C#

using Microsoft.AspNetCore.Mvc;
using Nocr.TextMatcher.Api.Contracts;
using Nocr.TextMatcher.Api.Contracts.TextMatches;
using Nocr.TextMatcher.Api.Contracts.TextMatches.Dto;
using Nocr.TextMatcher.AppServices.TextMatches;
using Nocr.TextMatcher.AppServices.TextMatches.Services;
namespace Nocr.TextMatcher.Host.Controllers;
[ApiController]
[Route(WebRoutes.TextMatches.Path)]
public class TextMatchController : ControllerBase
{
private readonly ITextMatchService _textMatchService;
public TextMatchController(ITextMatchService textMatchService)
{
_textMatchService = textMatchService ?? throw new ArgumentNullException(nameof(textMatchService));
}
[HttpPost]
public Task<long> Create([FromBody] CreateTextMatchRequest request, CancellationToken cancellationToken = default)
{
return _textMatchService.Create(request.UserId, request.ChatId, request.Template, request.Rule,
cancellationToken);
}
}