profile picture and basic info editors added
This commit is contained in:
@@ -4,14 +4,10 @@ using WatchIt.Database;
|
||||
|
||||
namespace WatchIt.WebAPI.Validators.Accounts;
|
||||
|
||||
public class AccountRequestValidator : AbstractValidator<AccountRequest>
|
||||
public class AccountProfileInfoRequestValidator : AbstractValidator<AccountProfileInfoRequest>
|
||||
{
|
||||
public AccountRequestValidator(DatabaseContext database)
|
||||
public AccountProfileInfoRequestValidator(DatabaseContext database)
|
||||
{
|
||||
RuleFor(x => x.Username).NotEmpty()
|
||||
.MaximumLength(50);
|
||||
RuleFor(x => x.Email).EmailAddress()
|
||||
.MaximumLength(320);
|
||||
RuleFor(x => x.Description).MaximumLength(1000);
|
||||
When(x => x.GenderId.HasValue, () =>
|
||||
{
|
||||
@@ -0,0 +1,13 @@
|
||||
using FluentValidation;
|
||||
using WatchIt.Common.Model.Accounts;
|
||||
|
||||
namespace WatchIt.WebAPI.Validators.Accounts;
|
||||
|
||||
public class AccountProfilePictureRequestValidator : AbstractValidator<AccountProfilePictureRequest>
|
||||
{
|
||||
public AccountProfilePictureRequestValidator()
|
||||
{
|
||||
RuleFor(x => x.Image).NotEmpty();
|
||||
RuleFor(x => x.MimeType).Matches(@"\w+/.+").WithMessage("Incorrect mimetype");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user