diff --git a/package.json b/package.json index 9fa2d11e..63d903da 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,9 @@ { "name": "client", - "version": "1.1.1", + "version": "1.1.2", "private": true, + "author": "abdelilah ouaadouch", + "description": "inventory management app", "scripts": { "dev": "vite", "build": "run-p type-check build-only", diff --git a/src-tauri/src/reposotories/product_repo.rs b/src-tauri/src/reposotories/product_repo.rs index 70e6f45f..6c485de2 100644 --- a/src-tauri/src/reposotories/product_repo.rs +++ b/src-tauri/src/reposotories/product_repo.rs @@ -20,7 +20,7 @@ pub fn get_products(page: i32, connection: &mut SqliteConnection) -> Value { products::price, products::tva, diesel::dsl::sql::( - "COALESCE(SUM(inventory_mouvements.quantity), 0) AS quantity", + "COALESCE(SUM(CASE WHEN inventory_mouvements.model = 'IN' THEN inventory_mouvements.quantity WHEN inventory_mouvements.model = 'OUT' THEN -inventory_mouvements.quantity END), 0) AS quantity", ), )) .group_by(products::id) diff --git a/src-tauri/stocker.sqlite b/src-tauri/stocker.sqlite index b984c254..4cbb7edb 100644 Binary files a/src-tauri/stocker.sqlite and b/src-tauri/stocker.sqlite differ