feat: track individual skeins with lifecycle, consume without losing allocation, event log, soft-delete projects #65

Merged
theis merged 2 commits from consumption_tracking into main 2026-07-19 14:22:20 +00:00
Owner

Introduce yarn_skeins as first-class units (free → allocated → used) to fix
consumption destroying allocation coverage and stock history.

Migration (007_yarn_skeins):
- Add yarn_skeins, project_yarn_skeins, yarn_events tables
- Backfill skeins from existing yarn_rolls.quantity
- Transfer locations to skein rows
- Convert project_yarns qty to individual skein links (non-consumed)
- Drop old bulk tables (project_yarns, yarn_location_assignments)
- Add projects.deleted_at for soft-delete

Backend:
- Consume sets status='used' + consumed_at; owned quantity unchanged
- Allocate picks free skeins via pickFreeSkeins() with location preference
- Return only affects in-progress (consumed_at IS NULL) skeins
- Soft-delete: sets deleted_at, returns non-consumed skeins to free
- Append-only events: acquired, allocated, returned, consumed, etc.
- GET /api/v1/yarn/:id/events and GET /api/v1/projects/:id/events
- yarn_rolls.status derived from skein counts (free/allocated/used/partial)
- Yarn CRUD: quantity changes insert/delete free skeins with events

Frontend:
- Project detail shows "X used · Y left" breakdown per allocation
- Consume button label is "Mark used"; disabled when nothing in progress
- Yarn list bar shows free / allocated / used / owned
- Delete checks only free skeins rather than status field
- Types updated with in_progress_qty, consumed_qty, free_qty, used_qty
- Project delete confirm text references archive + history

Docs:
- data-model.md updated for new schema and lifecycle
- api.md reflects new allocate/return/consume semantics and event endpoints
- README has upgrade notes for Docker Compose hosts
Introduce yarn_skeins as first-class units (free → allocated → used) to fix consumption destroying allocation coverage and stock history. Migration (007_yarn_skeins): - Add yarn_skeins, project_yarn_skeins, yarn_events tables - Backfill skeins from existing yarn_rolls.quantity - Transfer locations to skein rows - Convert project_yarns qty to individual skein links (non-consumed) - Drop old bulk tables (project_yarns, yarn_location_assignments) - Add projects.deleted_at for soft-delete Backend: - Consume sets status='used' + consumed_at; owned quantity unchanged - Allocate picks free skeins via pickFreeSkeins() with location preference - Return only affects in-progress (consumed_at IS NULL) skeins - Soft-delete: sets deleted_at, returns non-consumed skeins to free - Append-only events: acquired, allocated, returned, consumed, etc. - GET /api/v1/yarn/:id/events and GET /api/v1/projects/:id/events - yarn_rolls.status derived from skein counts (free/allocated/used/partial) - Yarn CRUD: quantity changes insert/delete free skeins with events Frontend: - Project detail shows "X used · Y left" breakdown per allocation - Consume button label is "Mark used"; disabled when nothing in progress - Yarn list bar shows free / allocated / used / owned - Delete checks only free skeins rather than status field - Types updated with in_progress_qty, consumed_qty, free_qty, used_qty - Project delete confirm text references archive + history Docs: - data-model.md updated for new schema and lifecycle - api.md reflects new allocate/return/consume semantics and event endpoints - README has upgrade notes for Docker Compose hosts
feat: track individual skeins with lifecycle, consume without losing allocation, event log, soft-delete projects
All checks were successful
/ test-frontend (push) Successful in 20s
/ test-backend (push) Successful in 1m17s
ce13ede745
Introduce yarn_skeins as first-class units (free → allocated → used) to fix
consumption destroying allocation coverage and stock history.

Migration (007_yarn_skeins):
- Add yarn_skeins, project_yarn_skeins, yarn_events tables
- Backfill skeins from existing yarn_rolls.quantity
- Transfer locations to skein rows
- Convert project_yarns qty to individual skein links (non-consumed)
- Drop old bulk tables (project_yarns, yarn_location_assignments)
- Add projects.deleted_at for soft-delete

Backend:
- Consume sets status='used' + consumed_at; owned quantity unchanged
- Allocate picks free skeins via pickFreeSkeins() with location preference
- Return only affects in-progress (consumed_at IS NULL) skeins
- Soft-delete: sets deleted_at, returns non-consumed skeins to free
- Append-only events: acquired, allocated, returned, consumed, etc.
- GET /api/v1/yarn/:id/events and GET /api/v1/projects/:id/events
- yarn_rolls.status derived from skein counts (free/allocated/used/partial)
- Yarn CRUD: quantity changes insert/delete free skeins with events

Frontend:
- Project detail shows "X used · Y left" breakdown per allocation
- Consume button label is "Mark used"; disabled when nothing in progress
- Yarn list bar shows free / allocated / used / owned
- Delete checks only free skeins rather than status field
- Types updated with in_progress_qty, consumed_qty, free_qty, used_qty
- Project delete confirm text references archive + history

Docs:
- data-model.md updated for new schema and lifecycle
- api.md reflects new allocate/return/consume semantics and event endpoints
- README has upgrade notes for Docker Compose hosts
fix: calcualte min manually
All checks were successful
/ test-frontend (push) Successful in 20s
/ test-backend (push) Successful in 1m15s
d7b0a884d7
theis merged commit ed398bf356 into main 2026-07-19 14:22:20 +00:00
theis deleted branch consumption_tracking 2026-07-19 14:22:20 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
theis/yarnman!65
No description provided.