праавки

This commit is contained in:
2025-03-12 10:19:03 +04:00
parent 86aefae2d4
commit a83fdd892d
2 changed files with 5 additions and 9 deletions

View File

@@ -26,9 +26,7 @@ internal class EmployeeStorageContract : IEmployeeStorageContract
}); });
_mapper = new Mapper(config); _mapper = new Mapper(config);
} }
public List<EmployeeDataModel> GetList(bool onlyActive = true, string? postId = null, DateTime? fromBirthDate = null, DateTime? toBirthDate = null, DateTime? fromEmploymentDate = null, DateTime? toEmploymentDate = null)
public List<EmployeeDataModel> GetList(bool onlyActive = true, string? email = null, DateTime? fromBirthDate = null, DateTime? toBirthDate = null,
DateTime? fromEmploymentDate = null, DateTime? toEmploymentDate = null, string postId = null)
{ {
try try
{ {
@@ -37,9 +35,9 @@ internal class EmployeeStorageContract : IEmployeeStorageContract
{ {
query = query.Where(x => !x.IsDeleted); query = query.Where(x => !x.IsDeleted);
} }
if (email is not null) if (postId is not null)
{ {
query = query.Where(x => x.PostId == email); query = query.Where(x => x.PostId == postId);
} }
if (fromBirthDate is not null && toBirthDate is not null) if (fromBirthDate is not null && toBirthDate is not null)
{ {
@@ -156,6 +154,4 @@ internal class EmployeeStorageContract : IEmployeeStorageContract
} }
private Employee? GetEmployeeById(string id) => _dbContext.Employees.FirstOrDefault(x => x.Id == id && !x.IsDeleted); private Employee? GetEmployeeById(string id) => _dbContext.Employees.FirstOrDefault(x => x.Id == id && !x.IsDeleted);
} }

View File

@@ -9,5 +9,5 @@ namespace MagicCarpetTests.Infrastructure;
internal class ConfigurationDatabaseTest : IConfigurationDatabase internal class ConfigurationDatabaseTest : IConfigurationDatabase
{ {
public string ConnectionString => "Host=local;Port=5432;Database=MagicCarpetTest;Username=postgres;Password=postgres;"; public string ConnectionString => "Host=127.0.0.1;Port=5432;Database=MagicCarpetTest;Username=postgres;Password=postgres;";
} }