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
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:
@@ -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 }
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user