changes in model, actor roles adding in person edit page finished
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
using FluentValidation;
|
||||
using WatchIt.Common.Model.Roles;
|
||||
using WatchIt.Database;
|
||||
|
||||
namespace WatchIt.WebAPI.Validators.Roles;
|
||||
|
||||
public class ActorRoleMediaRequestValidator : AbstractValidator<ActorRoleMediaRequest>
|
||||
{
|
||||
public ActorRoleMediaRequestValidator(DatabaseContext database)
|
||||
{
|
||||
Include(new BaseActorRoleRequestValidator(database));
|
||||
RuleFor(x => x.PersonId).NotEmpty()
|
||||
.NotNull()
|
||||
.MustBeIn(database.Persons.Select(x => x.Id).ToList());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using FluentValidation;
|
||||
using WatchIt.Common.Model.Roles;
|
||||
using WatchIt.Database;
|
||||
|
||||
namespace WatchIt.WebAPI.Validators.Roles;
|
||||
|
||||
public class ActorRolePersonRequestValidator : AbstractValidator<ActorRolePersonRequest>
|
||||
{
|
||||
public ActorRolePersonRequestValidator(DatabaseContext database)
|
||||
{
|
||||
Include(new BaseActorRoleRequestValidator(database));
|
||||
RuleFor(x => x.MediaId).NotEmpty()
|
||||
.NotNull()
|
||||
.MustBeIn(database.Media.Select(x => x.Id).ToList());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using FluentValidation;
|
||||
using WatchIt.Common.Model.Roles;
|
||||
using WatchIt.Database;
|
||||
|
||||
namespace WatchIt.WebAPI.Validators.Roles;
|
||||
|
||||
public class ActorRoleUniversalRequestValidator : AbstractValidator<ActorRoleUniversalRequest>
|
||||
{
|
||||
public ActorRoleUniversalRequestValidator(DatabaseContext database)
|
||||
{
|
||||
Include(new BaseActorRoleRequestValidator(database));
|
||||
RuleFor(x => x.PersonId).NotEmpty()
|
||||
.NotNull()
|
||||
.MustBeIn(database.Persons.Select(x => x.Id).ToList());
|
||||
RuleFor(x => x.MediaId).NotEmpty()
|
||||
.NotNull()
|
||||
.MustBeIn(database.Media.Select(x => x.Id).ToList());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using FluentValidation;
|
||||
using WatchIt.Common.Model.Roles;
|
||||
using WatchIt.Database;
|
||||
|
||||
namespace WatchIt.WebAPI.Validators.Roles;
|
||||
|
||||
public class BaseActorRoleRequestValidator : AbstractValidator<ActorRoleRequest>
|
||||
{
|
||||
public BaseActorRoleRequestValidator(DatabaseContext database)
|
||||
{
|
||||
RuleFor(x => x.Name).NotEmpty()
|
||||
.MaximumLength(100);
|
||||
RuleFor(x => x.TypeId).NotEmpty()
|
||||
.NotNull()
|
||||
.MustBeIn(database.PersonActorRoleTypes.Select(x => x.Id).ToList());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user