Reputation: 31357
I wish to allow all application users to add their own categories for their products. The produts may vary A LOT so is not just something that I can predict and insert myself previously.
However, if we allow all users to add their own categories, we may have issues like:
User A inserts a category called: Fruits
User B inserts a category called: Food from trees
(this is a dummy example, but perhaps you get the problem).
Generally speaking, what ways to we have to avoid repetition on our system ?
I'm totally unaware of the ways we may have, so some resources, links, anything, are more then welcome.
Thanks a lot.
Upvotes: 2
Views: 379
Reputation: 3988
If is how i understand:
First, recomended categories name, if the user start type "fru", display an exists caregories callesd "fruits" and etc.
I use aliases, example:
Table Categories:
id (serial)
name (varchar)
aliasof (bigint)
From a backend i listing a new categories added, and if exists, make a relation:
Supose:
1 fruits 0
2 fruits of tree 1
Upvotes: 2
Reputation: 91752
Not the most friendly solution, but you could add all new entries to a queue that is moderated by a select number of users. Only after approval, the new entries will appear.
Upvotes: 3
Reputation: 799130
Hierarchical categories, so that when this situation is encountered it can be handled cleanly. Then when someone comes along and removes the child category the elements can be dumped into the parent category.
Upvotes: 0