fix(backend): auto-generate tag seed data from hashtags in items.json #672
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
While implementing E2E tests for the TipTap rich text editor integration (PR #670), we discovered that clicking hashtags in item popups did not trigger map filtering.
Investigation revealed that the seed data (
items.json) contains items with hashtags (e.g.,#sustainability,#community), but thetagscollection was empty. The hashtag click handler only triggers filtering when it finds a matching tag registered in the backend.Current Status (on
main)#sustainability) in the popuptagscollection is empty, so filtering silently failscurl http://localhost:8055/items/tagsreturns{"data":[]}Solution
Extended
backend/prepare-seed.jsto automatically:#hashtagpatterns from text fields initems.jsontags.jsonwith unique tags and auto-assigned colorsThe generated
tags.jsonis added to.gitignoresince it's derived fromitems.json.How to Test
docker compose down && sudo rm -rf ./data/database && docker compose up -dcd backend && ./push.sh && ./seed.sh#sustainabilityin the popup?tags=sustainabilityand map filters accordinglycurl http://localhost:8055/items/tagsreturns 34 tags