Skip to content

Conversation

hasanmo
Copy link
Member

@hasanmo hasanmo commented Oct 20, 2026

Change

Added recipe CRUD, Save/Unsave and Cookbook operations with Zod validation, cookie authentication and owner-only editing/deletion.

Added GraphQL contracts and frontend documentation. Frontend integration comes in step 3.

Verification

All project checks, API/database tests and browser tests passed.

AI use

AI assisted with analyze, modelling, documentation and testing.

@hasanmo hasanmo requested a review from a team as a code owner October 20, 2026 11:44
@hasanmo hasanmo requested review from oliveror and olestan October 20, 2026 11:44
Copy link
Member

@olestan olestan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall! Approving, but I noticed a few things that might be worth considering now or in future work. None of these are blockers.

Frontend/API discrepancies and future integration

  • Search: Explore and Cookbook currently support searching by ingredients and tags as well as title/description, while the API only searches title/description. I see that advanced search is planned for D3, which is fine. We should just keep this difference in mind during frontend integration, and ideally keep the query structure easy to extend when adding ingredient/tag search later.
  • Create Recipe fields: The API requires difficulty and separate prepMinutes/cookMinutes, while the current Add Recipe form only has one cooking-time field and no difficulty selection. The documentation already suggests possible mappings/defaults, but be careful to not store potentially misleading values.
  • Image uploads: The current form supports uploading/cropping images, but the API only accepts an image URL. I see that uploads are outside this PR's scope. We should decide how to handle this during integration (e.g. temporarily omitting images) and make sure the approach can accommodate proper image storage/uploading later without major changes to recipe CRUD.
  • Sorting and pagination: Explore and Cookbook currently offer several sorting options, while the API only sorts by creation date (newest first). Advanced sorting is planned for D3, but we should be careful during integration since sorting locally after fetching a paginated result would only sort that page, not all recipes. When implementing sorting later, it should therefore happen in the backend before pagination.

Code and architecture suggestions

  • GraphQL enums: Could be worth using enums for fixed values like RecipeDifficulty, RecipeVisibility, RecipeCategory, and CookbookScope instead of plain strings. This would improve type safety and keep frontend/backend values consistent, especially as we add more functionality.
  • SQL query structure: Some of the query construction in recipeRepository.ts is a bit complex, particularly the cookbook scope conditions. Extracting named helpers and separating access/visibility logic from filtering could improve readability and make it easier to add more search/filter options in D3.
  • Recipe list queries: The list queries currently fetch full recipe details, including ingredients and instructions, even when only summary data is needed for cards. Not urgent with our current dataset, but separating list-summary and detail queries could be useful as the application grows.
  • Error handling: The repository currently throws GraphQLError directly. Not a big issue for our project right now, but separating domain errors (e.g. RecipeNotFoundError) from GraphQL-specific errors could make the database layer more independent and easier to maintain.

Overall, nice work! Most of these are just things to keep in mind for frontend integration or future improvements.

@hasanmo
Copy link
Member Author

hasanmo commented Oct 22, 2026 •

Looks good overall! Approving, but I noticed a few things that might be worth considering now or in future work. None of these are blockers.

Frontend/API discrepancies and future integration

  • Search: Explore and Cookbook currently support searching by ingredients and tags as well as title/description, while the API only searches title/description. I see that advanced search is planned for D3, which is fine. We should just keep this difference in mind during frontend integration, and ideally keep the query structure easy to extend when adding ingredient/tag search later.
  • Create Recipe fields: The API requires difficulty and separate prepMinutes/cookMinutes, while the current Add Recipe form only has one cooking-time field and no difficulty selection. The documentation already suggests possible mappings/defaults, but be careful to not store potentially misleading values.
  • Image uploads: The current form supports uploading/cropping images, but the API only accepts an image URL. I see that uploads are outside this PR's scope. We should decide how to handle this during integration (e.g. temporarily omitting images) and make sure the approach can accommodate proper image storage/uploading later without major changes to recipe CRUD.
  • Sorting and pagination: Explore and Cookbook currently offer several sorting options, while the API only sorts by creation date (newest first). Advanced sorting is planned for D3, but we should be careful during integration since sorting locally after fetching a paginated result would only sort that page, not all recipes. When implementing sorting later, it should therefore happen in the backend before pagination.

Code and architecture suggestions

  • GraphQL enums: Could be worth using enums for fixed values like RecipeDifficulty, RecipeVisibility, RecipeCategory, and CookbookScope instead of plain strings. This would improve type safety and keep frontend/backend values consistent, especially as we add more functionality.
  • SQL query structure: Some of the query construction in recipeRepository.ts is a bit complex, particularly the cookbook scope conditions. Extracting named helpers and separating access/visibility logic from filtering could improve readability and make it easier to add more search/filter options in D3.
  • Recipe list queries: The list queries currently fetch full recipe details, including ingredients and instructions, even when only summary data is needed for cards. Not urgent with our current dataset, but separating list-summary and detail queries could be useful as the application grows.
  • Error handling: The repository currently throws GraphQLError directly. Not a big issue for our project right now, but separating domain errors (e.g. RecipeNotFoundError) from GraphQL-specific errors could make the database layer more independent and easier to maintain.

Overall, nice work! Most of these are just things to keep in mind for frontend integration or future improvements.

Addresses review feedback by introducing GraphQL enums for difficulty, visibility, category and cookbook scope, regenerating contracts, and separating SQL access rules from list filters. Adds enum contract tests and extends cookbook visibility coverage.

Documents the upcoming frontend integration: explicit difficulty and prep/cook fields, temporary image-upload limitations, and controls that match current API search and sorting support.

Frontend integration will follow in a separate branch. D3 will add ingredient/tag search and backend sorting before pagination. List/detail query optimization and domain-error separation remain future improvements.

Validation: 235 tests and API/database tests passed, along with lint, type checks, contract generation checks and build. The full check command is blocked by an existing formatting issue in unchanged app.ts.

@hasanmo hasanmo merged commit fe07e01 into dev Oct 22, 2026
2 checks passed
@hasanmo hasanmo mentioned this pull request Oct 28, 2026
@oliveror oliveror deleted the hasan/feat/recipe-crud-cookies branch October 30, 2026 10:45
Sign in to join this conversation on GitHub.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants