feat: implement dynamic category solutions in MegaMenu navigation and convert static footer buttons to Next.js links

This commit is contained in:
parsa aghaei committed 2026-07-15 13:53:23 +03:30
1 parent 0ccf37f922
commit 1d9b699d61
5 files changed
+107 -33

No files matched your search

@@ -77,6 +77,25 @@ export class ProductsController {
return this.productsService.getActiveFilters();
}
@Get('navigation-filters')
@ApiOperation({ summary: 'دریافت فیلترها و راهکارهای ناوبری (دسته با علائم مربوطه)' })
@ApiOkResponse({
description: 'ساختار درختی فیلترها و تگ‌های درمانی واقعی متصل به محصولات',
schema: {
example: [
{
id: '1',
name: 'مفاصل و استخوان',
slug: 'joints',
symptoms: ['درد مفاصل', 'لنگش']
}
]
}
})
getNavigationFilters() {
return this.productsService.getNavigationFilters();
}
@Get(':id')
@ApiOperation({ summary: 'دریافت اطلاعات محصول با شناسه یکتا (ID)' })
@ApiOkResponse({
+35
View File
@@ -98,4 +98,39 @@ export class ProductsService {
petTypes: petTypesDb.map(p => p.suitableFor).filter(Boolean),
};
}
async getNavigationFilters() {
const categories = await this.prisma.category.findMany({
where: {
products: {
some: {}
}
},
include: {
products: {
include: {
symptoms: true
}
}
}
});
return categories.map(cat => {
const symptomSet = new Set<string>();
cat.products.forEach(p => {
p.symptoms.forEach(s => {
if (s.symptom) {
symptomSet.add(s.symptom);
}
});
});
return {
id: cat.id,
name: cat.name,
slug: cat.slug,
symptoms: Array.from(symptomSet)
};
});
}
}