Best way to deal with multiple tags and categories created by user in phoenix api

Hey community,

The following scenario kept me thinking:

A Blog application with multiple tags and categories that can be created or added by users.

My thinking went in this direction:

separate tags and categories tables and join with posts

Should the tags and categories have the following schema?

-name[] or name?

-name[] or name?

How do I read the name[] also how do I add the tag id to the relation table post_tags?
Also how can i invoke the create method when a tag or category doesn’t exist?

All the help you are offering is going into a full tutorial on how to create a medium clone front-end back-end that will be released under MIT.

How to deal with this?

Thank you in advanced

So after some thinking, I got the following idea:

  • use the frontend mutation and add a condition if tag already in tag table then don’t create a new tag else invoke the create tag method.

Still thinking about using lists for tags.

Take a look at this tutorial by @AlchemistCamp
It´s pretty much what you’re looking for

1 Like

Thank you the tutorial looks very promising