linting issues

This commit is contained in:
Chris Cochrun 2024-06-25 06:30:09 -05:00
parent 9b70af3dba
commit 0330876377
7 changed files with 128 additions and 368 deletions

View file

@ -39,17 +39,13 @@ pub async fn camp_form(MultipartForm(form): MultipartForm<CampForm>) -> HttpResp
let first = form
.first_name
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let last = form
.last_name
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let full_name = format!("{} {}", first, last);
@ -58,114 +54,86 @@ pub async fn camp_form(MultipartForm(form): MultipartForm<CampForm>) -> HttpResp
"{} {}",
form.parent_first_name
.as_ref()
.unwrap_or(&Text {
0: String::from("")
})
.unwrap_or(&Text(String::from("")))
.0
.clone(),
form.parent_last_name
.as_ref()
.unwrap_or(&Text {
0: String::from("")
})
.unwrap_or(&Text(String::from("")))
.0
.clone()
);
let birthdate = form
.birthdate
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let gender = form
.gender
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let street = form
.street
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let city = form
.city
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let state = form
.state
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let zip = form.zip.as_ref().unwrap_or(&Text { 0: 0 }).0.clone();
let zip = form.zip.as_ref().unwrap_or(&Text(0)).0;
let parent_phone = form
.parent_phone
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let parent_email = form
.parent_email
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let grade = form
.grade
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let shirt = form
.shirt
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let allergies = form
.allergies
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let week = form
.week
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let registration = form
.registration
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let reg = registration.clone();

View file

@ -45,57 +45,43 @@ pub async fn church_form(MultipartForm(form): MultipartForm<ChurchForm>) -> Http
let relationship = form
.relationship
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let walk = form
.walk
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let positive = form
.positive
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let negative = form
.negative
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let commitment = form
.commitment
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let teachable = form
.teachable
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let notes = form
.notes
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
log::info!("{first} {last} filled out a Church Reference form!");

View file

@ -66,245 +66,185 @@ pub async fn health_form(MultipartForm(form): MultipartForm<HealthForm>) -> Http
let first = form
.first_name
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let last = form
.last_name
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let full_name = format!("{} {}", first, last);
let registration = form
.registration
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let email_subject = format!("{} {} filled out a health form!", first, last);
let filename_noext = String::from(format!("{}_{}", first, last));
let filename_noext = format!("{}_{}", first, last);
let parent = format!(
"{} {}",
form.parent_first_name
.as_ref()
.unwrap_or(&Text {
0: String::from("")
})
.unwrap_or(&Text(String::from("")))
.0
.clone(),
form.parent_last_name
.as_ref()
.unwrap_or(&Text {
0: String::from("")
})
.unwrap_or(&Text(String::from("")))
.0
.clone()
);
let birthdate = form
.birthdate
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let street = form
.street
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let city = form
.city
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let state = form
.state
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let zip = form
.zip
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let parent_cellphone = form
.parent_cellphone
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let homephone = form
.homephone
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let contact = form
.contact
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let contact_phone = form
.contact_phone
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let doctorname = form
.doctorname
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let doctorcity = form
.doctorcity
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let doctorphone = form
.doctorphone
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let medical = form
.medical
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let insurance = form
.insurance
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let policy_number = form
.policy_number
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let agreement = form
.agreement
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let allergies = form
.allergies
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let allergies_other = form
.allergies_other
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let specific_allergies = form
.specific_allergies
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let treatment = form
.treatment
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let conditions = form
.conditions
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let tetanus = form
.tetanus
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let swimming = form
.swimming
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let medication = form
.medication
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let notes = form
.notes
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
log::info!("{first} {last} filled out a health form!");
@ -444,7 +384,7 @@ pub async fn health_form(MultipartForm(form): MultipartForm<HealthForm>) -> Http
log::info!("{:?}", file_exists);
if let Some(f) = form.file {
if let Some(file) = f.file_name {
if let Some(ext) = file.rsplit(".").next() {
if let Some(ext) = file.rsplit('.').next() {
filename = format!("{}.{}", filename_noext, ext);
path = Some(format!("./tmp/{}.{}", filename_noext, ext));
} else {
@ -565,6 +505,6 @@ pub async fn health_form(MultipartForm(form): MultipartForm<HealthForm>) -> Http
// HttpResponse::Ok().body("hi")
}
async fn post_health_form(form: HealthForm) -> bool {
async fn post_health_form(_form: HealthForm) -> bool {
todo!()
}

View file

@ -44,17 +44,13 @@ pub async fn local_form(MultipartForm(form): MultipartForm<LocalForm>) -> HttpRe
let first = form
.first_name
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let last = form
.last_name
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let email_subject = format!("{} {} signed up for the local mission trip!", first, last);
@ -62,147 +58,111 @@ pub async fn local_form(MultipartForm(form): MultipartForm<LocalForm>) -> HttpRe
"{} {}",
form.parent_first_name
.as_ref()
.unwrap_or(&Text {
0: String::from("")
})
.unwrap_or(&Text(String::from("")))
.0
.clone(),
form.parent_last_name
.as_ref()
.unwrap_or(&Text {
0: String::from("")
})
.unwrap_or(&Text(String::from("")))
.0
.clone()
);
let birthdate = form
.birthdate
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let gender = form
.gender
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let street = form
.street
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let city = form
.city
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let state = form
.state
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let zip = form.zip.as_ref().unwrap_or(&Text { 0: 0 }).0.clone();
let zip = form.zip.as_ref().unwrap_or(&Text(0)).0;
let cellphone = form
.cellphone
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let parentphone = form
.parentphone
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let email = form
.email
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let parentemail = form
.parentemail
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let school = form
.school
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let grade = form
.grade
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let pastor = format!(
"{} {}",
form.pastor_first_name
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone(),
form.pastor_last_name
.as_ref()
.unwrap_or(&Text {
0: String::from("")
})
.unwrap_or(&Text(String::from("")))
.0
.clone()
);
let church_attendance = form
.church_attendance
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let tfc_group = form
.tfc_group
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let shirt = form
.shirt
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
log::info!("{first} {last} signed up for the local mission trip!");

View file

@ -70,270 +70,204 @@ pub async fn mt_form(MultipartForm(form): MultipartForm<MtForm>) -> HttpResponse
let first = form
.first_name
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let last = form
.last_name
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let email_subject = format!("{} {} signed up for mission trip!", first, last);
let filename_noext = String::from(format!("{}_{}", first, last));
let filename_noext = format!("{}_{}", first, last);
let parent = format!(
"{} {}",
form.parent_first_name
.as_ref()
.unwrap_or(&Text {
0: String::from("")
})
.unwrap_or(&Text(String::from("")))
.0
.clone(),
form.parent_last_name
.as_ref()
.unwrap_or(&Text {
0: String::from("")
})
.unwrap_or(&Text(String::from("")))
.0
.clone()
);
let birthdate = form
.birthdate
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let gender = form
.gender
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let street = form
.street
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let city = form
.city
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let state = form
.state
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let zip = form.zip.as_ref().unwrap_or(&Text { 0: 0 }).0.clone();
let zip = form.zip.as_ref().unwrap_or(&Text(0)).0;
let cellphone = form
.cellphone
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let parentphone = form
.parentphone
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let email = form
.email
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let parentemail = form
.parentemail
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let school = form
.school
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let grade = form
.grade
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let pastor = format!(
"{} {}",
form.pastor_first_name
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone(),
form.pastor_last_name
.as_ref()
.unwrap_or(&Text {
0: String::from("")
})
.unwrap_or(&Text(String::from("")))
.0
.clone()
);
let church_attendance = form
.church_attendance
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let tfc_group = form
.tfc_group
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let shirt = form
.shirt
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let trip = form
.trip
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let trip_notes = form
.trip_notes
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let relationship = form
.relationship_with_jesus
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let testimony = form
.testimony
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let involvement = form
.involvement_with_group
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let reasons = form
.reasons
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let strengths = form
.strengths
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let weaknesses = form
.weaknesses
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let previous_trip = form
.previous_trip_info
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let attitude = form
.attitude
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let relevant = form
.relevant_notes
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let final_agreement = form
.final_agreement
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let registration = form
.registration
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
log::info!("{first} {last} signed up for mission trip!");
@ -489,7 +423,7 @@ pub async fn mt_form(MultipartForm(form): MultipartForm<MtForm>) -> HttpResponse
log::info!("{:?}", file_exists);
if let Some(f) = form.file {
if let Some(file) = f.file_name {
if let Some(ext) = file.rsplit(".").next() {
if let Some(ext) = file.rsplit('.').next() {
filename = format!("{}.{}", filename_noext, ext);
path = Some(format!("./tmp/{}.{}", filename_noext, ext));
} else {

View file

@ -46,65 +46,49 @@ pub async fn parent_form(MultipartForm(form): MultipartForm<ParentForm>) -> Http
let email = form
.email
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let authority = form
.authority
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let positive = form
.positive
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let negative = form
.negative
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let family = form
.family_relation
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let previous_trip_info = form
.previous_trip_info
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let feelings = form
.trip_feelings
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let notes = form
.notes
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
log::info!("{first} {last} filled out a parent form!");

View file

@ -42,49 +42,37 @@ pub async fn teacher_form(MultipartForm(form): MultipartForm<TeacherForm>) -> Ht
let relationship = form
.relationship
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let attitudes = form
.attitudes
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let positive = form
.positive
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let negative = form
.negative
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let team = form
.team
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
let notes = form
.notes
.as_ref()
.unwrap_or(&Text {
0: String::from(""),
})
.unwrap_or(&Text(String::from("")))
.0
.clone();
log::info!("{first} {last} filled out a teacher form!");