public CreateUserValidator(PhoTexBlogContext context) { _context = context; RuleFor(x => x.FirstName) .NotEmpty() .WithMessage("First name is required!") .MinimumLength(3) .WithMessage("First name must have at least 3 letters!"); RuleFor(x => x.LastName) .NotEmpty() .WithMessage("Last name is required!") .MinimumLength(5) .WithMessage("Last name must have at least 5 letters!"); RuleFor(x => x.Email) .NotEmpty() .WithMessage("Email is required!") .EmailAddress() .WithMessage("Invalid email format") .Must(email => UniqueEmail(email)) .WithMessage("User already registered!"); RuleFor(x => x.Password) .NotEmpty() .WithMessage("Password is required!") .MinimumLength(5) .WithMessage("Password must have at least 5 characters"); }
public CreatePostValidator(PhoTexBlogContext context) { _context = context; RuleFor(x => x.Title) .NotEmpty() .WithMessage("Title is required!") .MinimumLength(3) .WithMessage("Title must have at least 3 characters!"); RuleFor(x => x.Content) .NotEmpty() .WithMessage("Content is required!") .MinimumLength(20) .WithMessage("Content must have at least 20 characters!"); RuleFor(x => x.TopicId) .NotEmpty() .WithMessage("TopicId is required!") .Must(id => TopicExists(id)) .WithMessage("Topic with that id doesn't exist!"); RuleFor(x => x.UserId) .NotEmpty() .WithMessage("UserId is required!") .Must(id => UserExists(id)) .WithMessage("User with that id doesn't exist!"); }
public CreateUseCaseValidator(PhoTexBlogContext context) { _context = context; RuleFor(x => x.Name) .NotEmpty().WithMessage("Name must not be empty!") .Must(name => NotExists(name)).WithMessage("UseCase already exists!"); }
public CreateTopicValidator(PhoTexBlogContext context) { _context = context; RuleFor(x => x.Name) .NotEmpty() .WithMessage("Name is required!") .Must(name => NotExists(name)) .WithMessage("Topic with that name already exists!"); }
public CreateCommentValidator(PhoTexBlogContext context) { _context = context; RuleFor(x => x.CommentText) .NotEmpty().WithMessage("CommentText is required!") .MinimumLength(10).WithMessage("CommentText must have at least 10 characters!"); RuleFor(x => x.PostId) .NotEmpty().WithMessage("PostId is required!") .Must(id => PostExist(id)).WithMessage("Post with that id doesn't exist!"); }
public UpdateUseCaseValidator(PhoTexBlogContext context) { _context = context; RuleFor(x => x.Id) .NotEmpty().WithMessage("Id is required!") .Must(id => Exist(id)).WithMessage("UseCase with that ID doesn't exist"); RuleFor(x => x.Name) .NotEmpty().WithMessage("Name is required!"); RuleFor(x => x) .Must(x => BeUnique(x)).WithMessage("UseCase already exists!"); }
public CreateRatingValidator(PhoTexBlogContext context) { _context = context; RuleFor(x => x.Value) .NotEmpty().WithMessage("Value is required") .InclusiveBetween(1, 10).WithMessage("Value range is from 1 to 10"); RuleFor(x => x.PostId) .NotEmpty().WithMessage("PostId is required!") .Must(id => PostExists(id)).WithMessage("Post with that Id doesn't exist!"); RuleFor(x => x) .Must(x => UserNotRated(x)) .WithMessage("You have already rated this post!"); }
public CreateUserUseCaseValidator(PhoTexBlogContext context) { _context = context; RuleFor(x => x.UseCaseId) .NotEmpty().WithMessage("UseCaseId is required!") .Must(id => UseCaseExists(id)).WithMessage("UseCase with that id doesn't exist"); RuleFor(x => x.UserId) .NotEmpty().WithMessage("UserId is required!") .Must(id => UserExists(id)).WithMessage("User with that ID doesn't exist!"); RuleFor(x => x) .Must(x => NotExist(x)).WithMessage("This user already has that privilege!"); }
public UpdateTopicValidator(PhoTexBlogContext context) { _context = context; RuleFor(x => x.Name) .NotEmpty() .WithMessage("Name is required!"); RuleFor(x => x.Id) .NotEmpty() .Must(id => exist(id)) .WithMessage("Topic with that id doesn't exist!"); RuleFor(x => x) .NotEmpty() .Must(x => BeUnique(x)) .WithMessage($"Topic already exists!"); }
public UpdateUserValidator(PhoTexBlogContext context) { _context = context; RuleFor(x => x.Id) .NotEmpty() .WithMessage("Id is required!") .Must(id => Exist(id)) .WithMessage("User with that ID doesn't exist!"); RuleFor(x => x.FirstName) .NotEmpty() .WithMessage("First name is required!") .MinimumLength(3) .WithMessage("First name must have at least 3 letters!"); RuleFor(x => x.LastName) .NotEmpty() .WithMessage("Last name is required!") .MinimumLength(5) .WithMessage("Last name must have at least 5 letters!"); RuleFor(x => x.Email) .NotEmpty() .WithMessage("Email is required!") .EmailAddress() .WithMessage("Invalid email format"); RuleFor(x => x) .Must(x => BeUnique(x)) .WithMessage("Email already taken!"); RuleFor(x => x.Password) .NotEmpty() .WithMessage("Password is required!") .MinimumLength(5) .WithMessage("Password must have at least 5 characters"); }
public EfGetCommentsQuery(PhoTexBlogContext context) { _context = context; }
public EfGetOneTopicQuery(PhoTexBlogContext context) { _context = context; }
public DBLogger(PhoTexBlogContext context) { _context = context; }
public EfCreateCommentCommand(PhoTexBlogContext context, CreateCommentValidator validator, IApplicationActor actor) { _context = context; _validator = validator; _actor = actor; }
public JwtManager(PhoTexBlogContext context, string issuer, string secretKey) { _context = context; _issuer = issuer; _secretKey = secretKey; }
public EfGetOneRatingQuery(PhoTexBlogContext context) { _context = context; }
public EfGetOneUseCaseQuery(PhoTexBlogContext context) { _context = context; }
public EfGetUseCaseLogsQuery(PhoTexBlogContext context) { _context = context; }
public EfGetRatingsQuery(PhoTexBlogContext context) { _context = context; }
public EfGetOnePostQuery(PhoTexBlogContext context) { _context = context; }
public EfGetTopicsQuery(PhoTexBlogContext context) { _context = context; }
public EfCreatePostCommand(PhoTexBlogContext context, CreatePostValidator validator) { _context = context; _validator = validator; }
public EfCreateUserCommand(PhoTexBlogContext context, CreateUserValidator validator, IEmailSender sender) { _context = context; _validator = validator; _sender = sender; }
public EfUpdatePostCommand(PhoTexBlogContext context, UpdatePostValidator validator, IApplicationActor actor) { _context = context; _validator = validator; _actor = actor; }
public EFCreateTopicCommand(PhoTexBlogContext context, CreateTopicValidator validator) { _context = context; _validator = validator; }
public EfCreateUseCaseCommand(PhoTexBlogContext context, CreateUseCaseValidator validator) { _context = context; _validator = validator; }
public EfGetPostsQuery(PhoTexBlogContext context) { _context = context; }
public EfSoftDeleteTopicCommand(PhoTexBlogContext context) { _context = context; }
public EfGetUsersQuery(PhoTexBlogContext context) { _context = context; }
public EfSoftDeleteCommentCommand(PhoTexBlogContext context, IApplicationActor actor) { _context = context; _actor = actor; }