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 <[email protected]>
This commit is contained in:
lucioandClaude Opus 4.6 committed 2026-05-21 21:04:22 -07:00
1 parent 737a48ac30
commit 5e82e32491
1 file changed
+13 -1
+13 -1
View File
@@ -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