feat(ux-fix): resolve wiki fallback 404, responsive B2B modal, clean badges, aligned bullets, mobile bottom nav on PDP and admin Rx/symptoms management
Deploy Canina / deploy (push) Failing after 1m14s

This commit is contained in:
devops committed 2026-10-18 12:51:04 +00:00
1 parent 52446592e7
commit 468170349d
8 files changed
+168 -54

No files matched your search

+15
View File
@@ -354,4 +354,19 @@ export class AdminController {
await this.settingsService.updateBulkUiTexts(body);
return { success: true, data: body };
}
@Get("symptoms")
@ApiOperation({ summary: "لیست کامل علائم درمانی به همراه تعداد محصولات متصل" })
async getAllSymptoms() {
const data = await this.adminService.getAllSymptoms();
return { success: true, data };
}
@Put("symptoms/rename")
@ApiOperation({ summary: "تغییر نام یکپارچه یک علامت در سراسر محصولات و دیتابیس" })
async renameSymptom(@Body() body: { oldName: string; newName: string }) {
const result = await this.adminService.renameSymptom(body.oldName, body.newName);
return { success: true, ...result };
}
}
+61
View File
@@ -1869,4 +1869,65 @@ export class AdminService {
};
});
}
async getAllSymptoms() {
const rawSymptoms = await this.prisma.productSymptom.groupBy({
by: ['symptom'],
_count: {
productId: true,
},
orderBy: {
symptom: 'asc',
},
});
return rawSymptoms.map((s) => ({
name: s.symptom,
productsCount: s._count.productId,
}));
}
async renameSymptom(oldName: string, newName: string) {
if (!oldName?.trim() || !newName?.trim()) {
throw new BadRequestException('نام قبلی و جدید علامت الزامی است');
}
const cleanOld = oldName.trim();
const cleanNew = newName.trim();
return await this.prisma.(async (tx) => {
// 1. Rename in product_symptoms join table
const updatedJoin = await tx.`
UPDATE product_symptoms
SET symptom = ${cleanNew}
WHERE symptom = ${cleanOld};
`;
// 2. Cascade rename in products.dosage_config->'symptoms' jsonb array
await tx.`
UPDATE products
SET dosage_config = jsonb_set(
dosage_config,
'{symptoms}',
(
SELECT jsonb_agg(
CASE
WHEN elem::text = to_jsonb(${cleanOld}::text)::text THEN to_jsonb(${cleanNew}::text)
ELSE elem
END
)
FROM jsonb_array_elements(dosage_config->'symptoms') AS elem
)
)
WHERE dosage_config ? 'symptoms'
AND dosage_config->'symptoms' @> to_jsonb(${cleanOld}::text);
`;
return {
success: true,
message: \`علامت «${cleanOld}» با موفقیت به «${cleanNew}» در سراسر سیستم تغییر یافت\`,
updatedCount: updatedJoin,
};
});
}
}