feat(api): macro indexing from .kc files and read-only API

- Add MacroFile type to internal/kc and extract silo/macros/* files
  from .kc ZIP archives on commit
- Create ItemMacroRepository with ReplaceForItem, ListByItem, and
  GetByFilename methods
- Add GET /{partNumber}/macros (list) and
  GET /{partNumber}/macros/{filename} (source content) endpoints
- Index macros in extractKCMetadata with SSE broadcast
- List endpoint omits content for lightweight responses

Closes #144
This commit is contained in:
Forbes
2026-02-18 19:03:44 -06:00
parent cffcf56085
commit 6e6c9c2c75
6 changed files with 245 additions and 0 deletions

View File

@@ -57,6 +57,7 @@ type Server struct {
settings *db.SettingsRepository
metadata *db.ItemMetadataRepository
deps *db.ItemDependencyRepository
macros *db.ItemMacroRepository
}
// NewServer creates a new API server.
@@ -87,6 +88,7 @@ func NewServer(
locations := db.NewLocationRepository(database)
metadata := db.NewItemMetadataRepository(database)
itemDeps := db.NewItemDependencyRepository(database)
itemMacros := db.NewItemMacroRepository(database)
seqStore := &dbSequenceStore{db: database, schemas: schemas}
partgen := partnum.NewGenerator(schemas, seqStore)
@@ -117,6 +119,7 @@ func NewServer(
settings: settings,
metadata: metadata,
deps: itemDeps,
macros: itemMacros,
}
}