|
|
|
|
@ -40,8 +40,8 @@ async fn search_contract(contract_number: web::Path<String>) -> HttpResponse { |
|
|
|
|
let mut resp = SearchResponse{paid_in_full: vec![], checks: None}; |
|
|
|
|
dotenv().ok(); |
|
|
|
|
let mut config = Config::new(); |
|
|
|
|
config.host("172.16.181.143"); |
|
|
|
|
config.port(1433); |
|
|
|
|
config.host(var("HOST").expect("No HOST set in .env")); |
|
|
|
|
config.port(var("PORT").expect("No HOST set in .env").parse::<u16>().expect("Could not parse port to u16")); |
|
|
|
|
config.authentication(AuthMethod::windows(var("USER_NAME").expect("No USER_NAME set in .env"), var("PASSWORD").expect("No PASSWORD set in .env"))); |
|
|
|
|
config.trust_cert(); // on production, it is not a good idea to do this
|
|
|
|
|
|
|
|
|
|
@ -111,7 +111,10 @@ async fn find_checks(config: Config, search_data: Vec<(String, String, NaiveDate |
|
|
|
|
for row in rows { |
|
|
|
|
let check_number: &str = row.get("CHEKNUMB").unwrap(); |
|
|
|
|
let vendor: &str = row.get("VENDORID").unwrap(); |
|
|
|
|
let files: Vec<DirEntry> = WalkDir::new(&format!("\\\\LCCPHL-SSFSH001\\Mekorma PDF\\NLCF\\PROCESSED\\*{}*",check_number)).into_iter().filter_map(|e| e.ok()).collect(); |
|
|
|
|
let files: Vec<DirEntry> = WalkDir::new(&format!("{}*{}*", |
|
|
|
|
var("CHECK_FOLDER").expect("No HOST set in .env") ,check_number)) |
|
|
|
|
.into_iter().filter_map(|e| e.ok()) |
|
|
|
|
.collect(); |
|
|
|
|
if files.len() > 0 {found_checks.push([vendor.to_string(), files[0].file_name().to_str().unwrap().to_string()])} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|