diff --git a/src/inventory/adapters/output/db/postgres/errors.rs b/src/inventory/adapters/output/db/postgres/errors.rs index a3ac3f6..cf309b2 100644 --- a/src/inventory/adapters/output/db/postgres/errors.rs +++ b/src/inventory/adapters/output/db/postgres/errors.rs @@ -19,6 +19,8 @@ impl From for InventoryDBError { return Self::DuplicateStoreID; } else if msg.contains("cqrs_inventory_store_query_product_id_key") { return Self::DuplicateProductID; + } else if msg.contains("cqrs_inventory_product_customizations_query_customization_id_key") { + return Self::DuplicateCustomizationID; } else if msg.contains("cqrs_inventory_store_query_category_id_key") { return Self::DuplicateCategoryID; } else if msg.contains("cqrs_inventory_product_query_name_key") { @@ -27,6 +29,8 @@ impl From for InventoryDBError { return Self::DuplicateProductName; } else if msg.contains("cqrs_inventory_store_query_name_key") { return Self::DuplicateStoreName; + } else if msg.contains("cqrs_inventory_product_customizations_query_name_key") { + return Self::DuplicateCustomizationName } else { println!("{msg}"); } diff --git a/src/inventory/application/port/output/db/errors.rs b/src/inventory/application/port/output/db/errors.rs index 66a7560..df3ddfb 100644 --- a/src/inventory/application/port/output/db/errors.rs +++ b/src/inventory/application/port/output/db/errors.rs @@ -15,5 +15,7 @@ pub enum InventoryDBError { DuplicateStoreID, DuplicateProductName, DuplicateProductID, + DuplicateCustomizationID, + DuplicateCustomizationName, InternalError, } diff --git a/src/inventory/application/services/errors.rs b/src/inventory/application/services/errors.rs index 9d71a1f..06663f4 100644 --- a/src/inventory/application/services/errors.rs +++ b/src/inventory/application/services/errors.rs @@ -15,6 +15,7 @@ pub enum InventoryError { DuplicateCategoryName, DuplicateStoreName, DuplicateProductName, + DuplicateCustomizationName, InternalError, } @@ -24,6 +25,7 @@ impl From for InventoryError { InventoryDBError::DuplicateCategoryName => Self::DuplicateCategoryName, InventoryDBError::DuplicateStoreName => Self::DuplicateStoreName, InventoryDBError::DuplicateProductName => Self::DuplicateProductName, + InventoryDBError::DuplicateCustomizationName => Self::DuplicateCustomizationName, InventoryDBError::DuplicateStoreID => { error!("DuplicateStoreID"); Self::InternalError @@ -36,6 +38,10 @@ impl From for InventoryError { error!("DuplicateCategoryID"); Self::InternalError } + InventoryDBError::DuplicateCustomizationID => { + error!("DuplicateCustomizationID"); + Self::InternalError + } InventoryDBError::InternalError => Self::InternalError, } }