testlib/dto/
question_request.rsuse serde::{Deserialize, Serialize};
use uuid::Uuid;
use crate::enums::question_type::QuestionType;
use crate::jsonb::question_option::QuestionOption;
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct QuestionRequest {
pub id: Option<Uuid>,
#[serde(rename = "question")]
pub question_body: String,
pub value: f32,
pub ver: Option<i32>,
pub correct_answer: Option<String>,
pub q_order: Option<i32>,
pub marking_comment: Option<String>,
pub test: Option<Uuid>,
pub picture_path: Option<String>,
pub video_path: Option<String>,
pub file_path: Option<String>,
#[serde(rename = "type")]
pub question_type: QuestionType,
pub options: Option<Vec<QuestionOption>>,
pub description: Option<String>,
}
impl QuestionRequest {
pub fn equal(&self, other: &QuestionRequest) -> bool {
let mut eq = true;
eq &= self.id == other.id;
eq &= self.question_body == other.question_body;
eq &= self.value == other.value;
eq &= self.ver == other.ver;
eq &= self.correct_answer == other.correct_answer;
eq &= self.q_order == other.q_order;
eq &= self.marking_comment == other.marking_comment;
eq &= self.test == other.test;
eq &= self.picture_path == other.picture_path;
eq &= self.video_path == other.video_path;
eq &= self.file_path == other.file_path;
eq &= self.question_type == other.question_type;
eq &= self.options == other.options;
eq &= self.description == other.description;
eq
}
}