From 5e82e3249111ee1bd93c811f48ab12cf2c90126c Mon Sep 17 00:00:00 2001 From: Lucio Chen Date: Thu, 21 May 2026 21:04:22 -0700 Subject: [PATCH] Auto-tag wizard-created assets with their catalog category When creating an asset via the wizard flow, the selected catalog category (e.g. "Tech & Electronics") is now automatically applied as a tag. If a matching tag doesn't exist yet, one is created using the catalog's color. Co-Authored-By: Claude Opus 4.6 --- internal/server/handlers.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/internal/server/handlers.go b/internal/server/handlers.go index 0fc4e6c..abcadb4 100644 --- a/internal/server/handlers.go +++ b/internal/server/handlers.go @@ -344,8 +344,20 @@ func (s *Server) handleItemCreate(w http.ResponseWriter, r *http.Request) { name = "New Asset" } - // 3. Resolve the room tag automatically + // 3. Auto-tag with the selected catalog category var tagIDs []int64 + for _, cat := range s.catalog { + if cat.ID == category { + tag, err := s.db.GetTagByName(cat.Name) + if err != nil { + tag, err = s.db.CreateTag(cat.Name, cat.Color, "Auto-created from catalog category") + } + if err == nil { + tagIDs = append(tagIDs, tag.ID) + } + break + } + } tagIDs = s.resolveRoomTag(lastLocID, tagIDs) // 4. Construct category description