feat: handle duplicate ID and name for Product and CategoryAggregate

This commit is contained in:
Aravinth Manivannan 2024-07-15 17:53:33 +05:30
parent 06066426d8
commit 79397b6b44
Signed by: realaravinth
GPG key ID: F8F50389936984FF

View file

@ -17,6 +17,14 @@ impl From<SqlxError> for InventoryDBError {
let msg = err.message();
if msg.contains("cqrs_inventory_store_query_store_id_key") {
return Self::DuplicateStoreID;
} else if msg.contains("cqrs_inventory_store_query_product_id_key") {
return Self::DuplicateProductID;
} else if msg.contains("cqrs_inventory_store_query_category_id_key") {
return Self::DuplicateCategoryID;
} else if msg.contains("cqrs_inventory_product_query_name_key") {
return Self::DuplicateProductName;
} else if msg.contains("cqrs_inventory_category_query_name_key") {
return Self::DuplicateProductName;
} else if msg.contains("cqrs_inventory_store_query_name_key") {
return Self::DuplicateStoreName;
} else {