source: src/FinkiChattery/FinkiChattery.Commands/Questioning/VoteAnswer/VoteAnswerValidator.cs@ ad079e5

dev
Last change on this file since ad079e5 was ad079e5, checked in by Стојков Марко <mst@…>, 3 years ago

Vote answer endpoint

  • Property mode set to 100644
File size: 780 bytes
Line 
1using FinkiChattery.Commands.Questioning.Validators;
2using FinkiChattery.Commands.Questioning.Validators.Contracts;
3using FinkiChattery.Common.User;
4using FinkiChattery.Persistence.UnitOfWork;
5using FluentValidation;
6
7namespace FinkiChattery.Commands.Questioning
8{
9 public class VoteAnswerValidator : AbstractValidator<VoteAnswerCommand>
10 {
11 public VoteAnswerValidator(IUnitOfWork unitOfWork, ICurrentUser currentUser)
12 {
13 CascadeMode = CascadeMode.Stop;
14
15 RuleFor(x => x).SetValidator(new StudentHasGoodReputationAndCanVoteAndAnswer(unitOfWork, currentUser));
16 RuleFor(x => new VoteAnswerByStudentIsValidDto(x.VoteType, x.AnswerUid)).SetValidator(new VoteAnswerByStudentIsValid(unitOfWork, currentUser));
17 }
18 }
19}
Note: See TracBrowser for help on using the repository browser.