fix: изменение проверок, убраны списки
This commit is contained in:
@@ -16,9 +16,6 @@ namespace BankContracts.DataModels;
|
||||
/// <param name="password">пароль</param>
|
||||
/// <param name="email">адрес электронной почты</param>
|
||||
/// <param name="phoneNumber">номер телефона</param>
|
||||
/// <param name="deposits">вклады</param>
|
||||
/// <param name="clients">клиенты</param>
|
||||
/// <param name="replenishments">пополнения</param>
|
||||
public class ClerkDataModel(
|
||||
string id,
|
||||
string name,
|
||||
@@ -27,10 +24,7 @@ public class ClerkDataModel(
|
||||
string login,
|
||||
string password,
|
||||
string email,
|
||||
string phoneNumber,
|
||||
List<DepositDataModel> deposits,
|
||||
List<ClientDataModel> clients,
|
||||
List<ReplenishmentDataModel> replenishments
|
||||
string phoneNumber
|
||||
) : IValidation
|
||||
{
|
||||
public string Id { get; private set; } = id;
|
||||
@@ -49,12 +43,6 @@ public class ClerkDataModel(
|
||||
|
||||
public string PhoneNumber { get; private set; } = phoneNumber;
|
||||
|
||||
public List<DepositDataModel> Deposits { get; private set; } = deposits;
|
||||
|
||||
public List<ClientDataModel> Clients { get; private set; } = clients;
|
||||
|
||||
public List<ReplenishmentDataModel> Replenishments { get; private set; } = replenishments;
|
||||
|
||||
public void Validate()
|
||||
{
|
||||
if (Id.IsEmpty())
|
||||
@@ -101,17 +89,5 @@ public class ClerkDataModel(
|
||||
{
|
||||
throw new ValidationException("Field PhoneNumber is not a phone number");
|
||||
}
|
||||
if (Deposits is null)
|
||||
{
|
||||
throw new ValidationException("Field Deposits is null");
|
||||
}
|
||||
if (Clients is null)
|
||||
{
|
||||
throw new ValidationException("Field Clients is null");
|
||||
}
|
||||
if (Replenishments is null)
|
||||
{
|
||||
throw new ValidationException("Field Replenishments is null");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,13 +61,13 @@ public class ClientDataModel(string id, string name, string surname, decimal bal
|
||||
{
|
||||
throw new ValidationException("The value in the field Clerkid is not a unique identifier");
|
||||
}
|
||||
if ((Deposits?.Count ?? 0) == 0)
|
||||
if (Deposits is null)
|
||||
{
|
||||
throw new ValidationException("The client must include deposits");
|
||||
throw new ValidationException("Field Deposits is null");
|
||||
}
|
||||
if ((CreditPrograms?.Count ?? 0) == 0)
|
||||
if (CreditPrograms is null)
|
||||
{
|
||||
throw new ValidationException("The client must include credit programs");
|
||||
throw new ValidationException("Field CreditPrograms is null");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,9 +69,9 @@ public class CreditProgramDataModel(string id, string name, decimal cost, decima
|
||||
{
|
||||
throw new ValidationException("The value in the field PeriodId is not a unique identifier");
|
||||
}
|
||||
if ((Currencies?.Count ?? 0) == 0)
|
||||
if (Currencies is null)
|
||||
{
|
||||
throw new ValidationException("The credit program must include currencies");
|
||||
throw new ValidationException("Field Currencies is null");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,9 +58,9 @@ public class DepositDataModel(string id, float interestRate, decimal cost, int p
|
||||
{
|
||||
throw new ValidationException("The value in the field ClerkId is not a unique identifier");
|
||||
}
|
||||
if ((Currencies?.Count ?? 0) == 0)
|
||||
if (Currencies is null)
|
||||
{
|
||||
throw new ValidationException("The deposit must include currencies");
|
||||
throw new ValidationException("Field Currencies is null");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,13 +16,9 @@ namespace BankContracts.DataModels;
|
||||
/// <param name="password">пароль</param>
|
||||
/// <param name="email">адрес электронной почты</param>
|
||||
/// <param name="phoneNumber">номер телефона</param>
|
||||
/// <param name="currencies">валюты</param>
|
||||
/// <param name="periods">сроки</param>
|
||||
/// <param name="creditPrograms">кредитные программы</param>
|
||||
public class StorekeeperDataModel(
|
||||
string id, string name, string surname, string middleName,
|
||||
string login, string password, string email, string phoneNumber, List<CurrencyDataModel> currencies,
|
||||
List<PeriodDataModel> periods, List<CreditProgramDataModel> creditPrograms) : IValidation
|
||||
string login, string password, string email, string phoneNumber) : IValidation
|
||||
{
|
||||
public string Id { get; private set; } = id;
|
||||
|
||||
@@ -40,12 +36,6 @@ public class StorekeeperDataModel(
|
||||
|
||||
public string PhoneNumber { get; private set; } = phoneNumber;
|
||||
|
||||
public List<CurrencyDataModel> Currencies { get; private set; } = currencies;
|
||||
|
||||
public List<PeriodDataModel> Periods { get; private set; } = periods;
|
||||
|
||||
public List<CreditProgramDataModel> CreditPrograms { get; private set; } = creditPrograms;
|
||||
|
||||
public void Validate()
|
||||
{
|
||||
if (Id.IsEmpty())
|
||||
@@ -92,17 +82,5 @@ public class StorekeeperDataModel(
|
||||
{
|
||||
throw new ValidationException("Field PhoneNumber is not a phone number");
|
||||
}
|
||||
if (Currencies is null)
|
||||
{
|
||||
throw new ValidationException("Field Currencies is null");
|
||||
}
|
||||
if (Periods is null)
|
||||
{
|
||||
throw new ValidationException("Field Periods is null");
|
||||
}
|
||||
if (CreditPrograms is null)
|
||||
{
|
||||
throw new ValidationException("Field CreditPrograms is null");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user