2025-08-09 13:37:34 +02:00

20 lines
677 B
C#

using ApplicationHub.Domain.Contracts.Authentication;
using ApplicationHub.Domain.Contracts.Authentication.Models;
using AutoMapper;
using Microsoft.EntityFrameworkCore;
namespace ApplicationHub.Data.EF.Authentication.Repositories;
public class UserRepository(AuthenticationDataContext authenticationDataContext, IMapper mapper) : IUserRepository
{
public User? GetUserByUserName(string userName)
{
return mapper.Map<List<User>>(
authenticationDataContext.Users
.Include(x => x.Groups)
.Where(x => x.UserName == userName && x.Active)
.ToList()
)
.FirstOrDefault();
}
}