zinc-collective / convene

An Operating System for the Solidarity Economy
https://convene.zinc.coop
Other
56 stars 19 forks source link

✨ `Marketplace`: Add `Product#tags` #2190

Closed zspencer closed 2 months ago

zspencer commented 3 months ago

Products can now be tagged with things like Gluten Free or Vegan, and will show up as such under Product listings

After

Screenshot 2024-02-08 at 8 40 46 AM
rosschapman commented 2 months ago

@zspencer can you provide some justification for implementing tags using a relational architecture through a bridge table vs using an array column on a Product? I generally understand the tradeoffs between these two methodologies, so was hoping you could help me understand why you might prefer one way over another for Convene.

Spitballing...I can imagine a Product -> Tags relationship using an array column, that also retains referential integrity if those tags are only chosen via a select dropdown from a pre-filled Tags record table. (Presuming referential integrity being one major benefit to the relational model.) Of course, an underlying question is whether constraining the tags to a strict taxonomy might be preferable over user-generated values?

Does my question(ing) make sense?

zspencer commented 2 months ago

To be honest, I don't really think there's enough difference to encourage one or the other in this particular use case.

My main goal here was making it so Members can decide what Tags are allowed in the Marketplace context. Rails doesn't have great built-in support for searching / filtering by array fields in Postgresql; so this is the "most boring" way to go with it.

If we were to implement it as a field-on-a-row; we'd need to get into deeper arcana than I think is necessary.

zspencer commented 2 months ago

A question I think is of greater importance here is what we call these things. label and tag are both methods defined in Rails views.

So, what should we call them? Do we call them tags even though it's a name collision? In the Journal, we call them Keywords... Maybe it's actually Product#features?

zspencer commented 2 months ago

@rosschapman - I lied! I forgot that I didn't have clarity on the lesser of N evils, regarding what we call these.

zspencer commented 2 months ago

Or maybe we just go hella specific and call them Product#dietary_restrictions for now?

anaulin commented 2 months ago

@zspencer can you provide some justification for implementing tags using a relational architecture through a bridge table vs using an array column on a Product? I generally understand the tradeoffs between these two methodologies, so was hoping you could help me understand why you might prefer one way over another for Convene.

The justification is that Rails people have a bizarre kink for bridge tables. 😉

(I hate bridge tables, because I'm not a Real Rails Person.)

anaulin commented 2 months ago

Or maybe we just go hella specific and call them Product#dietary_restrictions for now?

Just to record a brief summary of the convo we just had during ensemble: seems like calling them tags gives us a bit more flexibility.

zspencer commented 2 months ago

The justification is that Rails people have a bizarre kink for bridge tables. 😉

Is it a kink if it's inflicted against our will through trauma... oh wait.