Auto-fill AssetItem.warrantyEndDate from AssetModel.warrantyMonths
CI / test (push) Failing after 8s

AssetModel gains an optional warrantyMonths (standard vendor warranty
length). createAssetItem() now defaults warrantyEndDate to purchaseDate +
warrantyMonths (month-end clamped, e.g. Dec 31 + 2mo -> Feb 28, not Mar 3)
whenever the caller omits warrantyEndDate -- still overridable per item
for batches with extended/different warranty terms. /asset-models UI gets
an input for the new field; /assets needs no change since it already
omits warrantyEndDate from the payload when left blank.

Hand-written migration + manual smoke test (tsx script, not Vitest),
same deviation as the other 2026-08-2x work in this branch -- see
CLAUDE.md. tsc/lint clean.
This commit is contained in:
toanhoang
2026-08-21 09:10:55 -04:00
parent 8ac95c974b
commit d9b360c1df
7 changed files with 110 additions and 4 deletions
@@ -0,0 +1,3 @@
-- Hand-written (same deviation as other 2026-08-2x migrations in this
-- feature area -- see CLAUDE.md).
ALTER TABLE "asset_models" ADD COLUMN "warranty_months" INTEGER;