Skip to content

Add sub-categories #434

Open
Open
@php-coder

Description

@php-coder

Thoughts:

  • it shouldn't be possible to create sub-category with the name of category (and opposite)
  • category "Prehistoric animals" should become a sub-category of "Фауна" category (should we update existing mapping?)
  • top-level categories should be visible as optgroups and it shouldn't be possible to chose them

TODO:

  • prototype of the /series/add page
    • "Animals" category should be removed
    • "Fauna" > "Prehistoric animals" category and sub-category should be created
  • /series/add page
    • add support for showing categories/sub-categories
  • Migrations:
    • add category.top_category_id field (nullable, foreign key to top_categories.id)
    • "Fauna" category should be created
    • "Prehistoric animals" should be sub-category of the "Fauna"
    • "Sport" category should be added (test data only)
    • "Animals" category should be removed (test data only)
  • /category/add page
    • add select "Parent category" (and hint that if it's empty than we'll create a top-level category)

TESTS:

  • /category/add, /series/add: re-display of selected category in case of error
  • display of selected category when user is opening /series/add/category/$category
  • integration test for adding sub-category

Notes:

  • we can create separate table for top-level categories (resolution: let's keep it simple and use single table for a while)
    • [pro] we shouldn't modify existing SQL-queries
    • [pro] less chances to break something
    • [con] we have to write separate validator for checking uniqueness
    • [con] more code will be added (migration, service, dao, tests)
  • @Category — in one case we need only parent and in others only children. Currently, we always looking for any category
  • categories and subcategories vs top categories and categories

Metadata

Metadata

Assignees

Labels

ADR/neededA decision has been made and it needs to be documentedimpact/changelogThis change should be reflected in the NEWS.txt filekind/feature

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions