2023-12-01 16:41:37 +10:00
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
2026-04-30 10:35:31 +10:00
|
|
|
|
using PARR.Core.Repositories.Interfaces;
|
2023-12-01 16:41:37 +10:00
|
|
|
|
using PARR.DAL.Context;
|
2026-04-14 09:56:31 +10:00
|
|
|
|
using PARR.DAL.Repositories.Base;
|
2026-04-30 10:35:31 +10:00
|
|
|
|
using PARR.Domain.Entities;
|
2023-12-01 16:41:37 +10:00
|
|
|
|
|
2026-04-30 10:35:31 +10:00
|
|
|
|
namespace PARR.DAL.Repositories
|
2023-12-01 16:41:37 +10:00
|
|
|
|
{
|
2026-04-30 10:35:31 +10:00
|
|
|
|
internal class UserRepository : BaseRepository<User>, IUserRepository
|
2023-12-01 16:41:37 +10:00
|
|
|
|
{
|
2026-04-30 10:35:31 +10:00
|
|
|
|
public UserRepository(DataContext dataContext, ILogger<UserRepository> logger) : base(logger, dataContext) { }
|
2023-12-01 16:41:37 +10:00
|
|
|
|
|
|
|
|
|
|
public async Task<User?> GetByIpWithRolesAsync(string ipAddress)
|
|
|
|
|
|
{
|
|
|
|
|
|
return await EntitySet
|
|
|
|
|
|
.Include(t => t.Roles).ThenInclude(t => t.Role)
|
|
|
|
|
|
.FirstOrDefaultAsync(t => t.Ip == ipAddress);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|