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:
1 parent
737a48ac30
commit
5e82e32491
1 file changed
+13
-1
@@ -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
|
||||
|
||||
Reference in new issue
Block a user