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 | |
---|
1 | using FinkiChattery.Commands.Questioning.Validators;
|
---|
2 | using FinkiChattery.Commands.Questioning.Validators.Contracts;
|
---|
3 | using FinkiChattery.Common.User;
|
---|
4 | using FinkiChattery.Persistence.UnitOfWork;
|
---|
5 | using FluentValidation;
|
---|
6 |
|
---|
7 | namespace 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.