The simplest video tag service should have atleast four tables, a videos table, a tag lists table, a user table and a tags join table. We would prevent tag collisions through code.
User has many Editable tags, one user can see others tags. genreally this shouldnt be a problem but if one wants to search videos based on tags then redundaant tags would cause problems with indexing.
- Assumption is that the tag service uses Sql Database, a no Sql Document design would defer form this design.
- Should tags be approved, to prevent users from creating abusive tags?
- Searching videos based on tags?
- Redundant tags cause host of issues including indexing issues.
/tags
/search/tags?q="ra"
- User Table
id | username |
---|---|
. | . |
CONSTRAINT PRIMARY KEY(id)
CONSTRAINT UNIQUE KEY(username)
- Videos Table
id | name | user_id | tag_id |
---|---|---|---|
. | . | . | . |
CONSTRAINT PRIMARY KEY(id)
CONSTRAINT UNIQUE KEY(id)
- Tags Table
id | user_id | tag_name |
---|---|---|
. | . | . |
CONSTRAINT UNIQUE KEY(video_id, id, tag_name)
- Tags join Table
user_id | tag_id |
---|---|
. | . |
- User has many videos.
- User has many tags.
- Video has many tags through tags join table.