mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2024-11-21 21:09:22 +00:00
Improve code readability
This commit is contained in:
parent
bd272b2d36
commit
287937ac63
@ -7,14 +7,15 @@ use crate::data::user::User;
|
|||||||
|
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
pub struct ResGetSecurityQuestions {
|
pub struct ResGetSecurityQuestions {
|
||||||
questions: Vec<String>
|
questions: Vec<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ResGetSecurityQuestions {
|
impl ResGetSecurityQuestions {
|
||||||
pub fn new(user: &User) -> ResGetSecurityQuestions {
|
pub fn new(user: &User) -> ResGetSecurityQuestions {
|
||||||
let mut questions = Vec::new();
|
let questions = vec![
|
||||||
questions.push(user.security_question_1.clone().unwrap_or(String::new()));
|
user.security_question_1.clone().unwrap_or_default(),
|
||||||
questions.push(user.security_question_2.clone().unwrap_or(String::new()));
|
user.security_question_2.clone().unwrap_or_default(),
|
||||||
|
];
|
||||||
|
|
||||||
ResGetSecurityQuestions { questions }
|
ResGetSecurityQuestions { questions }
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user