Fix mediator

This commit is contained in:
2025-08-05 17:31:10 +07:00
parent 6c63b80f4a
commit 843239d187
9 changed files with 103 additions and 6 deletions

View File

@@ -86,6 +86,27 @@ public class PostgreSqlUserRepository : IUserRepository
await _context.SaveChangesAsync().ConfigureAwait(false);
}
public async Task<IEnumerable<User>> GetAllUsersAsync()
{
try
{
await EnsureConnectionOpenAsync();
var userEntities = await _context.Users
.AsNoTracking()
.ToListAsync()
.ConfigureAwait(false);
return userEntities.Select(PostgreSqlMappers.Map);
}
catch (Exception)
{
// If there's an error, try to reset the connection
await SafeCloseConnectionAsync();
throw;
}
}
public async Task UpdateUser(User user)
{
try