public CreatePostCommandValidator(IImageboardDbContext context)
        {
            _context = context;

            RuleFor(e => e.Text)
            .NotEmpty().WithMessage("Post text cannot be empty")
            .MaximumLength(15000).WithMessage("Post text must not exceed 15000 characters");

            RuleFor(e => e.Signature)
            .MaximumLength(32).WithMessage("Signature must not exceed 64 characters");

            RuleFor(e => e.Attachments)
            .Must(e => e.Count() < 6).WithMessage("It is possible to upload only up to 5 attachments");

            RuleForEach(e => e.Attachments)
            .Must(e => e.IsImage()).WithMessage("Attachment should be an image of type: jpg, jpeg, pjpeg, gif, png")
            .Must(e => e.Length <= 1024 * 1024 * 5).WithMessage("Attachment size must not exceed 5 megabytes");
        }
Exemplo n.º 2
0
 public GetGroupsQueryHandler(IImageboardDbContext context, IMapper mapper) : base(context, mapper)
 {
 }
Exemplo n.º 3
0
 public CreateTopicCommandHandler(IImageboardDbContext context, IMapper mapper, IDateTimeService dateTimeService, IFileService fileService) : base(context, mapper)
 {
     _dateTimeService = dateTimeService;
     _fileService     = fileService;
 }
Exemplo n.º 4
0
 public RequestHandlerBase(IImageboardDbContext context, IMapper mapper)
 {
     Context = context;
     Mapper  = mapper;
 }