Añadidos settings de cookies y privacidad
Run Tests on Branches / Detect Changes (push) Successful in 17s
Run Tests on Branches / Backend Tests (push) Successful in 2m30s
Run Tests on Branches / Frontend Tests (push) Successful in 1m54s
Run Tests on Branches / Frontend Mobile Tests (push) Successful in 1m49s
Run Tests on Branches / Parapharmacy API Tests (push) Successful in 1m48s
Run Tests on Branches / PIP Platform Tests (push) Has been skipped

This commit is contained in:
Antoni Nuñez Romeu
2026-08-26 17:14:05 +02:00
parent 80c473e439
commit 97008caf31
13 changed files with 185 additions and 12 deletions
+13 -1
View File
@@ -343,9 +343,21 @@ router.post('/bulk', requireServiceKey('INGEST_API_KEY'), async (req, res) => {
*/
router.put('/:id', requireServiceKey('ADMIN_API_KEY'), async (req, res) => {
try {
// Allowlist: only these fields can be modified via PUT
const ALLOWED_FIELDS = [
'name', 'brand', 'category', 'subcategory', 'description',
'image_url', 'source_url', 'price', 'original_price', 'source',
'source_product_id', 'available', 'rating', 'review_count',
];
const update = {};
for (const field of ALLOWED_FIELDS) {
if (field in req.body) update[field] = req.body[field];
}
update.updated_at = new Date();
const product = await Product.findByIdAndUpdate(
req.params.id,
{ ...req.body, updated_at: new Date() },
update,
{ new: true }
);