feat: add filtering by ServiceName and Key in email templates query and UI

This commit is contained in:
2026-05-17 11:43:25 +03:00
parent 3381fcc2f8
commit 07f536938f
7 changed files with 56 additions and 10 deletions
@@ -23,9 +23,12 @@ public class AdminTemplatesController : Controller
// GET /admin/templates
[HttpGet("")]
public async Task<IActionResult> Index(CancellationToken ct)
public async Task<IActionResult> Index([FromQuery] string? serviceName, [FromQuery] string? key, CancellationToken ct)
{
var result = await _mediator.Send(new GetAllEmailTemplatesQuery(), ct);
ViewData["ServiceNameFilter"] = serviceName;
ViewData["KeyFilter"] = key;
var result = await _mediator.Send(new GetAllEmailTemplatesQuery(serviceName, key), ct);
if (!result.IsSuccess)
{
ModelState.AddModelError("", result.Error?.Message ?? "Failed to load templates.");