Changeset 846cf1a


Ignore:
Timestamp:
11/02/21 21:02:45 (3 years ago)
Author:
Стојков Марко <mst@…>
Branches:
dev
Children:
80e2fe0
Parents:
728eb31
Message:

Answer question endpoint

Location:
src/FinkiChattery
Files:
7 added
3 edited

Legend:

Unmodified
Added
Removed
  • src/FinkiChattery/FinkiChattery.Commands/Questioning/QuestioningErrorCodes.cs

    r728eb31 r846cf1a  
    1111        public const string AnswerAlreadyUpvoted = "AnswerAlreadyUpvoted";
    1212        public const string AnswerAlreadyDownvoted = "AnswerAlreadyDownvoted";
    13         public const string StudentHasBadReputation = "StudentHasBadReputation";
     13        public const string StudentHasBadReputation = "StudentHasBadReputation";
     14        public const string AnswerTextLengthInvalid = "AnswerTextLengthInvalid";
     15        public const string QuestionNotFound = "QuestionNotFound";
    1416    }
    1517}
  • src/FinkiChattery/FinkiChattery.Commands/Questioning/Validators/QuestioningFluentValidationRules.cs

    r728eb31 r846cf1a  
    1616        }
    1717
     18        public static IRuleBuilderOptions<T, string> AnswerTextValidate<T>(this IRuleBuilder<T, string> ruleBuilder)
     19        {
     20            return ruleBuilder.NotNull().WithMessage(QuestioningErrorCodes.CantBeNull).MaximumLength(4000).WithMessage(QuestioningErrorCodes.AnswerTextLengthInvalid);
     21        }
     22
    1823        public static IRuleBuilderOptions<T, IEnumerable<U>> ListNotNull<T, U>(this IRuleBuilder<T, IEnumerable<U>> ruleBuilder)
    1924        {
  • src/FinkiChattery/FinkiChattery.Persistence/Models/Answer.cs

    r728eb31 r846cf1a  
    66    public class Answer : BaseEntity
    77    {
     8        public Answer() : base()
     9        {
     10            CreatedOn = DateTime.UtcNow;
     11            VotesCount = 0;
     12            CorrectAnswer = false;
     13        }
     14
    815        public string Text { get; set; }
    916
Note: See TracChangeset for help on using the changeset viewer.