Страница профиля

This commit is contained in:
Халимов Рустам
2026-02-13 14:24:01 +03:00
parent b24b9d697f
commit 1e72d006c4
34 changed files with 1169 additions and 27 deletions

View File

@@ -0,0 +1,32 @@
using MediatR;
using Microsoft.EntityFrameworkCore;
using Nashel.Modules.Identity.Application.Queries;
using Nashel.Modules.Identity.Infrastructure.Persistence;
namespace Nashel.Modules.Identity.Infrastructure.QueryHandlers;
public class SearchCompetenciesQueryHandler : IRequestHandler<SearchCompetenciesQuery, List<string>>
{
private readonly IdentityDbContext _context;
public SearchCompetenciesQueryHandler(IdentityDbContext context)
{
_context = context;
}
public async Task<List<string>> Handle(SearchCompetenciesQuery request, CancellationToken cancellationToken)
{
if (string.IsNullOrWhiteSpace(request.Query))
return new List<string>();
var query = request.Query.ToLower();
var competencies = await _context.Competencies
.Where(c => c.Name.ToLower().Contains(query))
.Select(c => c.Name)
.Take(10) // Ограничиваем результаты
.ToListAsync(cancellationToken);
return competencies;
}
}