diff --git a/.gitignore b/.gitignore index bd78c91..b431285 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ .env **/target /keys -/.vscode \ No newline at end of file +/.vscode +/ingress \ No newline at end of file diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml new file mode 100644 index 0000000..abb7aab --- /dev/null +++ b/.idea/dataSources.xml @@ -0,0 +1,15 @@ + + + + + mysql.8 + true + com.mysql.cj.jdbc.Driver + jdbc:mysql://localhost:3306/stock + $ProjectFileDir$ + + + + + + \ No newline at end of file diff --git a/src/methods/customer/structs.rs b/src/methods/customer/structs.rs index 5fb883c..b6f70f6 100644 --- a/src/methods/customer/structs.rs +++ b/src/methods/customer/structs.rs @@ -148,7 +148,7 @@ impl Customer { ON (REPLACE(JSON_EXTRACT(Transactions.customer, '$.customer_id'), '"', '')) = Customer.id WHERE - (LOWER(Customer.name) LIKE '?1' OR Customer.contact LIKE '?1') + (LOWER(Customer.name) LIKE '%?1%' OR Customer.contact LIKE '%?1%') AND Customer.tenant_id = '?2' GROUP BY Customer.id LIMIT 25 diff --git a/src/methods/ingress/handlers.rs b/src/methods/ingress/handlers.rs index c43fccb..f3cf7c2 100644 --- a/src/methods/ingress/handlers.rs +++ b/src/methods/ingress/handlers.rs @@ -26,7 +26,7 @@ async fn upload(session: Session, file: TempFile<'_>) -> Result<(), Error> { async fn receive_file(mut file: TempFile<'_>, tenant_id: String) -> Result<(), Error> { let current_date = Utc::now().to_rfc3339(); - let path = "/ingress/".to_string(); + let path = "./ingress/".to_string(); if let Err(error) = std::fs::create_dir_all(path.clone()) { return Err(ErrorResponse::create_error(&format!( "Unable to create file path, {}", diff --git a/src/methods/transaction/handlers.rs b/src/methods/transaction/handlers.rs index fcede62..4ec1076 100644 --- a/src/methods/transaction/handlers.rs +++ b/src/methods/transaction/handlers.rs @@ -146,7 +146,7 @@ async fn update_product_status( let fetched_transaction = Transaction::fetch_by_ref(&data.transaction_id, session.clone(), &db.0).await?; - match fetched_transaction.get(0) { + match fetched_transaction.first() { Some(transaction) => { let converted: Convert = Transaction::update_product_status(transaction.id.as_str(), data, session, &db.0) diff --git a/src/pool.rs b/src/pool.rs index fffacef..6a24666 100644 --- a/src/pool.rs +++ b/src/pool.rs @@ -146,7 +146,7 @@ pub async fn session_ingress_worker(db: &DbConn) { loop { interval.tick().await; - if let Ok(dir) = fs::read_dir("/ingress/") { + if let Ok(dir) = fs::read_dir("./ingress/") { let found_files = dir .map(|directory| directory.unwrap().path().to_str().unwrap().to_string()) .collect::>();