adding a more robust health form api

This commit is contained in:
Chris Cochrun 2024-01-09 06:01:02 -06:00
parent 3595ec45ea
commit 2110516859

View file

@ -63,14 +63,40 @@ struct HealthForm {
#[post("/health-form")]
pub async fn health_form(MultipartForm(form): MultipartForm<HealthForm>) -> HttpResponse {
let first = form.first_name.as_ref().unwrap().0.clone();
let last = form.last_name.as_ref().unwrap().0.clone();
let first = form
.first_name
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.0
.clone();
let last = form
.last_name
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.0
.clone();
let email_subject = format!("{} {} filled out a health form!", first, last);
let filename_noext = String::from(format!("{}_{}", first, last));
let parent = format!(
"{} {}",
form.parent_first_name.as_ref().unwrap().0.clone(),
form.parent_last_name.as_ref().unwrap().0.clone()
form.parent_first_name
.as_ref()
.unwrap_or(&Text {
0: String::from("")
})
.0
.clone(),
form.parent_last_name
.as_ref()
.unwrap_or(&Text {
0: String::from("")
})
.0
.clone()
);
let birthdate = form
.birthdate