feat(crm): persist product brands and aliases on create/update
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
ea43150b8a
commit
bfa0d50597
3 files changed
+318
-7
No files matched your search
@@ -34,7 +34,6 @@ from app.utils.crm_export_columns import (
|
||||
from app.utils.excel_export import export_rows_to_xlsx_response
|
||||
from app.crud.crm.product import (
|
||||
_category_row_to_dict,
|
||||
_product_row_to_dict,
|
||||
create_category,
|
||||
create_product,
|
||||
get_category,
|
||||
@@ -44,6 +43,7 @@ from app.crud.crm.product import (
|
||||
list_product_options,
|
||||
list_products,
|
||||
product_no_exists,
|
||||
product_to_dict,
|
||||
soft_delete_category,
|
||||
soft_delete_product,
|
||||
total_pages,
|
||||
@@ -624,7 +624,7 @@ def product_detail(
|
||||
if not obj:
|
||||
return error_response(404, "产品不存在")
|
||||
ensure_crm_create_by_row_in_scope(db, obj, user_info, tenant_no, message="无权访问该产品")
|
||||
return success_response(_product_row_to_dict(obj))
|
||||
return success_response(product_to_dict(db, obj))
|
||||
except ValueError as e:
|
||||
return error_response(400, str(e))
|
||||
except Exception as e:
|
||||
@@ -648,7 +648,7 @@ def product_add(
|
||||
user_id=user_id,
|
||||
**body.model_dump(exclude_unset=True),
|
||||
)
|
||||
return success_response(_product_row_to_dict(obj), message="创建成功")
|
||||
return success_response(product_to_dict(db, obj), message="创建成功")
|
||||
except ValueError as e:
|
||||
return error_response(400, str(e))
|
||||
except Exception as e:
|
||||
@@ -669,7 +669,7 @@ def product_update(
|
||||
tenant_no = get_tenant_no(db, _user)
|
||||
user_info = crm_user_info(_user)
|
||||
obj = update_product(db, product_id, user_id=user_id, user_info=user_info, **data)
|
||||
return success_response(_product_row_to_dict(obj), message="更新成功")
|
||||
return success_response(product_to_dict(db, obj), message="更新成功")
|
||||
except ValueError as e:
|
||||
return error_response(400, str(e))
|
||||
except Exception as e:
|
||||
|
||||
Reference in new issue
Block a user