Commit Graph

15 Commits

Author SHA1 Message Date
Forbes
a2a36141f0 feat: add BOM system with API, database repository, and FreeCAD workbench command
Implement the full Bill of Materials stack on top of the existing
relationships table and bom_single_level view from migration 001.

API endpoints (6 new routes under /api/items/{partNumber}/bom):
- GET    /bom              Single-level BOM for an item
- GET    /bom/expanded     Multi-level BOM via recursive CTE (depth param)
- GET    /bom/where-used   Reverse lookup: which parents use this item
- POST   /bom              Add child to BOM with quantity, ref designators
- PUT    /bom/{child}      Update relationship type, quantity, ref des
- DELETE /bom/{child}       Remove child from BOM

Database layer (internal/db/relationships.go):
- RelationshipRepository with full CRUD operations
- Single-level BOM query joining relationships with items
- Multi-level BOM expansion via recursive CTE (max depth 20)
- Where-used reverse lookup query
- Cycle detection at insert time to prevent circular BOMs
- BOMEntry and BOMTreeEntry types for denormalized query results

Server wiring:
- Added RelationshipRepository to Server struct in handlers.go
- Registered BOM routes in routes.go under /{partNumber} subrouter

FreeCAD workbench (pkg/freecad/silo_commands.py):
- 9 new BOM methods on SiloClient (get, expanded, where-used, add,
  update, delete)
- Silo_BOM command class with two-tab dialog:
  - BOM tab: table of children with Add/Edit/Remove buttons
  - Where Used tab: read-only table of parent assemblies
- Add sub-dialog with fields for part number, type, qty, unit, ref des
- Edit sub-dialog pre-populated with current values
- Remove with confirmation prompt
- silo-bom.svg icon matching existing toolbar style
- Command registered in InitGui.py toolbar

No new migrations required - uses existing relationships table and
bom_single_level view from 001_initial.sql.
2026-01-31 08:09:26 -06:00
Forbes
8b66274a7a Fix SIGSEGV: defer document open after dialog close
Opening documents (especially assemblies) inside the QDialog nested
event loop can crash FreeCAD when the Assembly solver triggers during
document restore. Move FreeCAD.openDocument() to after dialog.exec_()
returns.
2026-01-29 22:42:15 -06:00
Forbes
b200fd06bc Fix API URL: only auto-append /api for bare hostnames
Use urllib.parse to check if the URL has a path component. Only append
/api when the path is empty (e.g. https://silo.kindred.internal).
URLs that already include a path (e.g. http://localhost:8080/api) are
left unchanged. Restore localhost placeholder as the default.
2026-01-29 22:27:10 -06:00
Forbes
383e750a6d Fix API URL handling and SSL certificate verification
- Auto-append /api to base URL if not already present, so users can
  enter just the hostname (e.g. https://silo.kindred.internal)
- Load system CA certificate bundle in SSL context so the bundled
  Python trusts internal CAs (FreeIPA) without disabling verification
- Update settings dialog placeholder and hint text to clarify expected
  URL format
2026-01-29 22:26:26 -06:00
Forbes
bdccb8923d feat(workbench): fix icon loading and add settings dialog
Replace hardcoded FreeCAD addon path searches with __file__-relative
resolution for icons in both InitGui.py and silo_commands.py. Icons now
load correctly regardless of install location.

Add Silo_Settings command with URL and SSL verification fields. Settings
persist via FreeCAD preferences and take priority over env vars. Wire
SSL context into all SiloClient HTTP methods.
2026-01-29 19:28:11 -06:00
Forbes
f39aef0fc7 update documentation and specs 2026-01-29 13:10:12 -06:00
Forbes
d886a44288 update deploy.sh 2026-01-26 22:43:39 -06:00
Forbes
687e645deb improve csv import handling 2026-01-26 21:51:07 -06:00
Forbes
be222307bb add free-ipa setup 2026-01-26 21:37:53 -06:00
Forbes
5201b35d83 update deployment 2026-01-26 21:32:57 -06:00
Forbes
f37052c2f0 update deployment instructions 2026-01-26 21:31:49 -06:00
Forbes
f9324686c5 Add roadmap and deployment examples 2026-01-26 06:06:21 -06:00
Forbes
b396097715 Add revision control and project tagging migration 2026-01-24 16:27:18 -06:00
Forbes
c327baf36f update databasing system with minimum API, schema parsing and FreeCAD
integration
2026-01-24 15:03:17 -06:00
Forbes
eafdc30f32 first commit 2026-01-18 12:08:14 -06:00