Be42 recipe platform community review overhaul#265
Merged
TienNguyen3711 merged 3 commits intoMay 12, 2026
Conversation
TienNguyen3711
approved these changes
May 12, 2026
Collaborator
TienNguyen3711
left a comment
There was a problem hiding this comment.
Everything works well on my device. Approved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
BE37: Recipe Platform & Community Review Overhaul API
Summary
This PR upgrades the backend recipe platform to support a more complete Recipe Library, Community Review, Admin Management, Import/Enrichment, and Role Management workflow.
The main focus of this PR is to:
recipe_libraryas the central recipe data model for public, private, community, moderation, trash, import, enrichment, and social features.recipe_reviewssystem for both recipe library and community recipes.recipesdata to support community visibility and publishing flows./api/admin/user-roles.1. New and Updated API Surface
/api/recipe-library/public/api/recipe-library/community/api/recipe-library/my/api/recipe-library/add-meal/api/recipe-library/api/recipe-library/:id/api/recipe-library/:id/api/recipe-library/:id/api/recipe-library/:id/share-community/api/recipe-library/:id/like/api/recipe-library/:id/save/api/recipe-library/:id/comments/api/recipe-library/:id/report/api/recipe-library/admin/api/recipe-library/admin/pending-community/api/recipe-library/admin/:id/approve-community/api/recipe-library/admin/:id/reject-community/api/recipe-library/admin/:id/publish-catalog/api/recipe-library/admin/:id/unpublish-catalog/api/recipe-library/admin/:id/recover/api/recipe-library/admin/:id/permanent-delete/api/recipe-library/admin/import-names/api/recipe-library/admin/import-template/api/recipe-library/admin/import-file/api/recipe-library/admin/import-rows/api/recipe-library/admin/import-queue/api/recipe-library/admin/import-queue/:id/api/recipe-library/admin/import-queue/:id/trash/api/recipe-library/admin/import-queue/:id/recover/api/recipe-library/admin/import-queue/:id/api/recipe-library/admin/enrich-batch/api/recipe-library/admin/import-queue/approve/api/recipe-library/admin/fetch-images/api/recipe-reviews/feed/api/recipe-reviews/api/recipe-reviews/summary/api/recipe-reviews/api/recipe-reviews/:id/api/admin/user-roles/api/admin/user-roles/:userId/api/recipe/admin/all/api/recipe/admin/:id/visibility2. Backend File Changes
controller/recipeLibraryController.jscontroller/recipeReviewController.jscontroller/adminUserRoleController.jsservices/recipeLibraryService.jsservices/recipeReviewService.jssource_type, aggregate summaries, and review feed.routes/recipeLibrary.jsroutes/recipeReviews.jsroutes/adminUserRole.jsroutes/index.js/api/recipe-library,/api/recipe-reviews, and/api/admin.routes/recipe.jsroutes/routeGroups.jscontroller/recipeController.jsmodel/createRecipe.jsuser_private, saved ingredient cost, and improved image parsing/upload safety.model/getUserRecipes.jsmodel/deleteUserRecipes.jsrecipe_librarycleanup, and image cleanup.model/mealPlan.jsrecipe_mealcolumn.model/getUserProfile.jsmodel/updateUserProfile.jsgetUserProfileto prevent API crashes.controller/notificationController.jscreated_attotimestamp.routes/notifications.jsservices/apiResponseService.jscreatedAtfallback fromtimestamp.middleware/authenticateToken.jsroutes/systemRoutes.jsservices/securityEvents/securityResponseService.jsgetActiveBlocks,unblockIp, and standardised IP blocking behaviour.test/securityResponseService.test.jstechnical_docs/recipe-library-flow.mddatabase/*.sqlpackage.json,package-lock.json3. Database Schema and Migration Changes
database/recipe_library_schema.sqlrecipe_librarydatabase/recipe_library_schema.sqlrecipe_library_import_queuedatabase/recipe_library_schema.sqlrecipe_library_likes,recipe_library_saves,recipe_library_comments,recipe_library_reportsdatabase/recipe_library_schema.sqlpublished_recipe_libraryviewdatabase/2026-05-08_sync_meal_type_constraints.sqlrecipe_library,recipe_library_import_queuemeal_typevalues tootherand recreated constraints.database/2026-05-08_sync_recipe_library_source_constraint.sqlrecipe_libraryadmin_manualtoadmin_created.database/2026-05-10_recipe_reviews.sqlrecipe_reviewsdatabase/2026-05-10_sync_user_recipe_visibility.sqlrecipeslegacy tablevisibility,is_published,published_at, backfill logic, and indexes.4. Important Behaviour and Contract Changes
authenticateTokenandauthorizeRoles('admin').created_at.timestamp, with response fallback mapping.5. Runtime Data Tables Affected
recipesrecipe_libraryrecipe_library_import_queuerecipe_library_likes,recipe_library_saves,recipe_library_comments,recipe_library_reportsrecipe_reviewsnotificationsimages, storage imagesusers,user_roles6. Risks and Compatibility Notes
.DS_Store,logs/, anduploads/...are local runtime files.7. Suggested Testing Checklist
GET /api/recipe-library/publicreturns recipe data and count.GET /api/recipe-library/adminreturns200and list data with a valid admin token.GET /api/recipe-library/adminreturns401/403without a valid token.POST /api/recipe-reviews/summaryreturns the correct summary map by key.GET /api/admin/user-roleslists users and roles with correct filters.PATCH /api/admin/user-roles/:userIdupdates user role successfully.GET /api/recipe/admin/allis accessible only by admin.500with mixed legacy plaintext/encrypted data.8. Expected Outcome
After this PR, the backend provides a more complete, secure, and maintainable recipe platform foundation.
The system now supports centralised recipe library management, community publishing and moderation, recipe reviews, import and enrichment workflows, admin role management, improved auth safety, and stronger compatibility with the updated frontend recipe flows.