fix: set a default value for ID's
All checks were successful
Build / build (push) Successful in 58s
Build / deploy (push) Successful in 12s

Closes #51
This commit is contained in:
silver 2024-11-18 14:38:45 +00:00
parent 00ac57de63
commit 0b397369d1
Signed by: silver
GPG key ID: 36F93D61BAD3FD7D

View file

@ -98,9 +98,18 @@ async fn update_ldap(config: &Config, db: &Pool<Sqlite>) {
} }
impl From<&WolvesResultUser> for AccountWolves { impl From<&WolvesResultUser> for AccountWolves {
fn from(input: &WolvesResultUser) -> Self { fn from(input: &WolvesResultUser) -> Self {
let id_student = match input.student_id.to_owned() {
None => {
Some("00000000".to_string())
}
Some(x) => {
Some(x)
}
};
AccountWolves { AccountWolves {
id_wolves: input.member_id.parse::<i64>().unwrap_or(0), id_wolves: input.member_id.parse::<i64>().unwrap_or(0),
id_student: input.student_id.to_owned(), id_student,
email: input.contact_email.to_owned(), email: input.contact_email.to_owned(),
expiry: input.expiry.to_owned(), expiry: input.expiry.to_owned(),
name_first: Some(input.first_name.to_owned()), name_first: Some(input.first_name.to_owned()),