feat(procurement): validate acquisition lease fields and enforce bulk-receive capacity

Reject lease start/end and monthly payment on PURCHASE acquisitions (create and
update, validated against the resulting record). Add asset_acquisitions.item_name
column + migration. Enforce warehouse/yard/zone capacity on bulk receive and apply
capacity-counter deltas on save. Adds acquisition-guard spec.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Hagernesh
2026-07-22 11:59:37 +00:00
parent 59f06a9bd1
commit 8dc4dd585e
8 changed files with 201 additions and 42 deletions

View File

@@ -18,6 +18,12 @@ export enum AcquisitionStatus {
@Entity({ name: 'asset_acquisitions', schema: 'freight' })
@Index(['vehicleId', 'acquisitionDate'])
export class AssetAcquisition extends BaseEntity {
/** WHAT was acquired (vehicle, parts, equipment…) — the asset itself. */
@Column({ name: 'item_name', type: 'varchar', length: 200, nullable: true })
itemName?: string;
/** Optional link — only when the acquisition IS a fleet vehicle. Parts and
* general procurement stay unlinked so reports don't misattribute them. */
@Column({ name: 'vehicle_id', type: 'uuid', nullable: true })
vehicleId?: string;