update food

This commit is contained in:
2025-11-15 15:13:34 +03:30
parent afbca4e439
commit e1f68730f9
@@ -88,6 +88,9 @@ export class FoodService {
// attach new categories if provided (adds, does not attempt to preserve/remove existing ones)
if (Array.isArray(categoryIds) && categoryIds.length) {
const categories = await this.categoryRepository.find({ id: { $in: categoryIds } });
food.categories.removeAll();
categories.forEach(cat => {
// Collection.add will ignore duplicates
food.categories.add(cat);