Validators

Parent namespace: Backend

Classes

TypeDescription
ActivityValidatorThe ActivityValidator class provides static methods for validating and normalizing activity-related data transfer objects (DTOs) used in the creation and updating of activities. The ValidateRequest method checks the validity of the activity's time range, participant limit, and poster file if provided, as well as ensuring that only authorized users can create activities with certain features. The NormalizeCreateRequest method adjusts the DTO for creating an activity by setting the enrollment open date to null if the activity is marked as enrollable. The ParseCreateQuestions and ParseUpdateQuestions methods handle the deserialization of specification questions from JSON format, while the MapSpecificationQuestion method maps the properties of an UpdateSpecificationQuestionDTO to a SpecificationQuestion entity. These methods centralize the validation and normalization logic for activity-related operations, ensuring that incoming data is properly checked and formatted before being processed by the application.
AnswerValidatorProvides validation helpers for checking whether specification answers match a question type.
EnrollmentValidatorProvides validation helpers for enrollment requests and specification answers.
ExtensionValidatorProvides file-extension and MIME-type validation for uploaded images.
GroupValidatorProvides validation helpers for group-related fields.
SpecificationAnswerValidatorProvides validation helpers for mutating specification answers.
StateValidatorProvides object-state validation based on data-annotation attributes.
StudyEnrollmentValidatorProvides validation methods for study enrollments.