feat(meal-plan): add servings field to MealPlanEntry and update related functionality
feat(products): implement bulk update for product categories feat(recipes): add servings input to WriteRecipePage and update MealPlanClient for servings management refactor(types): enhance Product and Category types with additional properties
This commit is contained in:
@@ -397,4 +397,14 @@ export class ProductsService {
|
||||
]);
|
||||
return { ok: true };
|
||||
}
|
||||
|
||||
async bulkUpdate(ids: number[], data: { categoryId?: number | null }) {
|
||||
const updateData: Record<string, any> = {};
|
||||
if ('categoryId' in data) {
|
||||
updateData.categoryId = data.categoryId;
|
||||
}
|
||||
if (Object.keys(updateData).length === 0) return { updated: 0 };
|
||||
await this.prisma.product.updateMany({ where: { id: { in: ids } }, data: updateData });
|
||||
return { updated: ids.length };
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user