public EfUpdatePersonalPieceOfArtCommand(ArtsContext context, IMapper mapper, CreatePieceOfArtValidator validator, IApplicationActor actor)
 {
     this.context   = context;
     this.mapper    = mapper;
     this.validator = validator;
     this.actor     = actor;
 }
 public EfCreateCommentCommand(ArtsContext context, IApplicationActor actor, IMapper mapper, CreateCommentValidator validator)
 {
     this.validator = validator;
     this.context   = context;
     this.actor     = actor;
     this.mapper    = mapper;
 }
 public EfLikePostCommand(ArtsContext context, IMapper mapper, LikeValidator validator, IApplicationActor actor)
 {
     this.context   = context;
     this.mapper    = mapper;
     this.validator = validator;
     this.actor     = actor;
 }
 public EfRegisterUserCommand(ArtsContext context, RegisterUserValidator validator, IMapper mapper, IEmailSender email)
 {
     this.context   = context;
     this.validator = validator;
     this.mapper    = mapper;
     this.email     = email;
 }
 public CreateUserUseCaseValidator(ArtsContext context)
 {
     RuleFor(x => x.UseCaseId).NotEmpty();
     RuleFor(x => x.UserId).NotEmpty()
     .Must(x => context.Users.Any(user => user.Id == x))
     .WithMessage("Users Id has to be in database");
 }
 public UpdateCategoryValidator(ArtsContext context)
 {
     RuleFor(x => x.Name)
     .NotEmpty()
     .MinimumLength(3)
     .Must(c => !context.Categories.Any(ca => ca.Name == c))
     .WithMessage($"Category name must be unique, this name has been already taken.");
 }
        public RegisterUserValidator(ArtsContext context)
        {
            // i ovde isto u nekom momentu dodaj regularni izraz za first name
            RuleFor(x => x.FirstName).NotEmpty();
            RuleFor(x => x.LastName).NotEmpty();
            RuleFor(x => x.CountryId).NotEmpty();
            RuleFor(x => x.Password).NotEmpty().MinimumLength(8);

            RuleFor(x => x.Email).NotEmpty()
            .Must(x => !context.Users.Any(user => user.Email == x))
            .WithMessage("Email is already taken")
            .EmailAddress();

            RuleFor(x => x.PhoneNumber).Matches(@"^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$");
        }
        public CreateCommentValidator(ArtsContext context)
        {
            RuleFor(x => x.Text).NotEmpty();

            RuleFor(x => x.PieceOfArtId)
            .NotEmpty()
            .Must(pieceId => context.PieceOfArts.Any(p => p.Id == pieceId))
            .WithMessage("Piece of art have to exists in database.");


            RuleFor(x => x.ParentId)
            .Must(commID => context.Comments.Any(c => c.Id == commID))
            .When(request => request.ParentId != null)
            .WithMessage("Parent comment have to exists in database.");
        }
Example #9
0
        public CreateUserValidator(ArtsContext context)
        {
            RuleFor(x => x.FirstName).NotEmpty();
            RuleFor(x => x.LastName).NotEmpty();
            RuleFor(x => x.CountryId).NotEmpty();
            RuleFor(x => x.Password).NotEmpty().MinimumLength(8);
            RuleFor(x => x.Email).NotEmpty()
            .Must(x => !context.Users.Any(user => user.Email == x))
            .WithMessage("Email is already taken")
            .EmailAddress();

            RuleFor(x => x.useCasesForUser)
            .NotEmpty();

            RuleFor(x => x.PhoneNumber).Matches(@"^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$");
        }
        public CreatePieceOfArtValidator(ArtsContext context)
        {
            RuleFor(x => x.Name).NotEmpty().Must(x => !context.PieceOfArts.Any(piece => piece.Name == x))
            .WithMessage("Name of piece of art has to be unique. Name has been alreafy taken.").MinimumLength(3);

            RuleFor(x => x.Description).MinimumLength(15);

            RuleFor(x => x.Picture)
            .NotEmpty();


            RuleFor(x => x.CategoryId)
            .NotEmpty()
            .Must(catId => context.Categories.Any(p => p.Id == catId))
            .WithMessage("Category has to be valid.");

            RuleFor(x => x.Year).NotEmpty().InclusiveBetween(1000, 2020);

            RuleFor(x => x.Price).NotNull();
        }
Example #11
0
 public JwtManager(ArtsContext context)
 {
     this.context = context;
 }
 public UseCaseLogger(ArtsContext context, IMapper mapper)
 {
     this.context = context;
     this.mapper  = mapper;
 }
Example #13
0
 public EfDeleteCommentCommand(ArtsContext context, DeleteCommentValidator validator)
 {
     this.context   = context;
     this.validator = validator;
 }
 public EfDeletePersonalCommentCommand(ArtsContext context, IApplicationActor actor, DeleteCommentValidator validator)
 {
     this.validator = validator;
     this.context   = context;
     this.actor     = actor;
 }
 public EfCreatePieceOfArtCommand(ArtsContext context, IMapper mapper, CreatePieceOfArtValidator validator)
 {
     this.context   = context;
     this.mapper    = mapper;
     this.validator = validator;
 }
Example #16
0
 public CreateCountryValidator(ArtsContext context)
 {
     RuleFor(x => x.Name).NotEmpty().Must(name => !context.Countries.Any(c => c.Name == name))
     .WithMessage("Country has already exists in database.");
 }
Example #17
0
 public EfDeletePieceOfArtCommand(ArtsContext context, DeletePieceOfArtValidator validator)
 {
     this.context   = context;
     this.validator = validator;
 }
 public EfCreateUserUseCasesCommand(ArtsContext context, IMapper mapper, CreateUserUseCaseValidator validator)
 {
     this.context   = context;
     this.mapper    = mapper;
     this.validator = validator;
 }
 public EfDeleteCategoryCommand(ArtsContext context, DeleteCategoryValidator validator)
 {
     this.context   = context;
     this.validator = validator;
 }
Example #20
0
 public EfDeletePersonalPieceOfArtCommand(ArtsContext context, IApplicationActor actor)
 {
     this.actor   = actor;
     this.context = context;
 }
Example #21
0
 public EfGetPieceOfArtsQuery(ArtsContext context, IMapper mapper)
 {
     this.context = context;
     this.mapper  = mapper;
 }
 public EfGetOneUserQuery(ArtsContext context, IMapper mapper)
 {
     this.context = context;
     this.mapper  = mapper;
 }
Example #23
0
 public EfDeleteUserUseCaseCommand(ArtsContext context)
 {
     this.context = context;
 }
 public EfDeleteCountriesCommand(ArtsContext context, DeleteCountryValidator validator)
 {
     this.context   = context;
     this.validator = validator;
 }
Example #25
0
 public EfGetUsersClientQuery(ArtsContext context, IMapper mapper)
 {
     this.context = context;
     this.mapper  = mapper;
 }
Example #26
0
 public EfCreateCountryCommand(ArtsContext context, IMapper mapper, CreateCountryValidator validator)
 {
     this.context   = context;
     this.mapper    = mapper;
     this.validator = validator;
 }
 public EfGetUseCaseLogsQuery(ArtsContext context, IMapper mapper)
 {
     this.context = context;
     this.mapper  = mapper;
 }
Example #28
0
 public EfGetCategoriesQuery(ArtsContext context, IMapper mapper)
 {
     this.context = context;
     this.mapper  = mapper;
 }
Example #29
0
 public EfUpdateUserCommand(ArtsContext context, IMapper mapper, UpdateUserValidator validator)
 {
     this.context   = context;
     this.mapper    = mapper;
     this.validator = validator;
 }