Reviewed-on: #1 Co-authored-by: Sergey Nazarov <insight.appdev@gmail.com> Co-committed-by: Sergey Nazarov <insight.appdev@gmail.com>
28 lines
960 B
C#
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);
|
|
}
|
|
}
|