fix: resolve seed encoding, search param, and wiki data source issues

- Fix seed-products.ts TS error (implicit any) and BOM handling
- Re-run full seed to restore correct Persian encoding in DB
- Fix productService query→search param mismatch
- Fix IngredientWiki hardcoded port 4000→use settingsStore
- Restore seed-products-data.json from git after accidental corruption
This commit is contained in:
parsa aghaei committed 2026-07-11 15:40:49 +03:30
1 parent 804a596711
commit 7615aa0e51
74 files changed
+683 -659

No files matched your search

@@ -1,6 +1,16 @@
import api from './api';
import { PRODUCTS, Product, PetType } from "../data/products";
const CATEGORY_SLUG_TO_NAME: Record<string, string> = {
'joints': 'مفاصل و استخوان',
'immune': 'تقویت سیستم ایمنی و گوارش',
'energy': 'ویتامین‌ها و انرژی‌بخش‌ها',
'special-care': 'مراقبت‌های ویژه (پوست، دندان و چشم)',
'general': 'تقویت عمومی',
'nutrition': 'تغذیه تخصصی',
'supplements': 'مکمل‌های غذایی و درمانی',
};
export class ProductService {
private static instance: ProductService;
@@ -34,7 +44,7 @@ export class ProductService {
shortDescription: data.shortDescription,
price: data.priceDisplay || `${data.priceValue.toLocaleString('fa-IR')} تومان`,
priceValue: Number(data.priceValue),
category: data.category?.name || data.category || data.categorySlug || '',
category: data.category?.name || data.category || CATEGORY_SLUG_TO_NAME[data.categorySlug] || data.categorySlug || '',
categorySlug: data.categorySlug,
unit: data.unit,
packageSize: data.packageSize,
@@ -71,7 +81,7 @@ export class ProductService {
const params = new URLSearchParams();
if (filters?.category && filters.category !== "all") params.append('category', filters.category);
if (filters?.petType && filters.petType !== "all") params.append('petType', filters.petType);
if (filters?.query) params.append('query', filters.query);
if (filters?.query) params.append('search', filters.query);
try {
const response = await api.get(`/products?${params.toString()}`);