Refactoring, database structure changed
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
namespace WatchIt.DTO.Models.Controllers.Accounts.AccountProfileInfo;
|
||||
|
||||
public class AccountProfileInfoRequest
|
||||
{
|
||||
#region PROPERTIES
|
||||
|
||||
public string? Description { get; set; }
|
||||
public short? GenderId { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using FluentValidation;
|
||||
using WatchIt.Database;
|
||||
|
||||
namespace WatchIt.DTO.Models.Controllers.Accounts.AccountProfileInfo;
|
||||
|
||||
public class AccountProfileInfoRequestValidator : AbstractValidator<AccountProfileInfoRequest>
|
||||
{
|
||||
public AccountProfileInfoRequestValidator(DatabaseContext database)
|
||||
{
|
||||
RuleFor(x => x.Description).MaximumLength(1000);
|
||||
When(x => x.GenderId.HasValue, () =>
|
||||
{
|
||||
RuleFor(x => x.GenderId!.Value).MustBeIn(database.Genders.Select(x => x.Id));
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user