Skip to content

Conversation

@immonroe
Copy link
Contributor

Description

Added a database migration to enforce title length constraints on the recipe_revisions table. This ensures that recipe titles are meaningful and within reasonable bounds.

The constraint requires that recipe titles, when trimmed of whitespace, have a length between 3 and 150 characters. This prevents both empty/too-short titles and excessively long titles that could cause display issues.

  • Created migration files for adding/dropping the title_length_check constraint
  • Updated recipe service to handle the new constraint
  • Migration includes proper up/down scripts for safe deployment

Tested the constraint enforcement using GraphQL playground with a title exceeding less than 3 characters as well as over 150 characters:

mutation checkTitleLength {
  recipe {
    create(input: {slug: "unique-slug-n", revision: {
      title: "", 
      tags: [], ingredients: [], steps: []
    }, private: true}) {
      id
    }
  }
}

Note: task migrate-up currently fails due to existing data in the database that violates the new constraint. This is expected behavior and will require data cleanup before the migration can be applied in production.

Checklist

  • [ x ] I have tested these changes
  • [ x ] I have updated documentation as needed

Related Issues

Closes #72

@immonroe immonroe self-assigned this Aug 13, 2025
Copy link
Contributor

@GV14982 GV14982 left a comment

Choose a reason for hiding this comment

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

This looks pretty straightforward to me. I know we had talked about refactoring the RecipeService to have the CreateRecipe method call the AddRevision method. Can you do me a favor and make a ticket for that?

@GV14982 GV14982 merged commit a33aeca into main Aug 20, 2025
3 checks passed
@GV14982 GV14982 deleted the task/72-empty-recipe-revision-titles branch August 20, 2025 03:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Empty Recipe Revision Titles

3 participants