feat(assignments): close and reopen assignment on person swap

This commit is contained in:
2026-06-25 17:20:24 +02:00
parent b4b63e107a
commit 18e274ef37
5 changed files with 472 additions and 78 deletions
+11
View File
@@ -0,0 +1,11 @@
# Changelog
## Unreleased
### Breaking Changes
- **W-3 (fix-assignment-asset-movement-audit)**: `Assignment.id` is no longer stable across person swaps. When `updateAssignmentUseCase` or `updateAssetUseCase` changes a person on an active assignment, the old assignment is now closed (with `closedAt`/`closedById` set; `AssignmentStockReturn` row created for QUANTITY; `AssignmentAssetLine.returnedAt` set for SERIALIZED) and a NEW `Assignment` is created with a new `id`. Any code that holds an `Assignment.id` expecting stability across person swaps must be updated to look up the new id (e.g., via the active `Assignment` for the person/asset). The change replaces a phantom `RETURN` + `ASSIGNMENT` pattern that wrote both movements to the same `Assignment.id` without creating an `AssignmentStockReturn` row.
## Released
_Unreleased changes appear above. Released versions will be added below as they are tagged._