feat(inventory): mark field-created records as real instances

This commit is contained in:
2026-09-08 18:08:19 -03:00
parent ead1beb9d7
commit e082f5d062
@@ -122,7 +122,16 @@ export class F3FieldInventoryStructureService {
asset: { id: string; code: string; name: string };
[key: string]: unknown;
};
if (!family) return created;
// F5: the Inventory screens count only concrete instances confirmed/created in field.
// Legacy/context/catalog records intentionally remain false until explicitly validated.
await this.dataSource.query(`
UPDATE assets
SET is_inventory_instance=true,updated_by=$2::uuid,updated_at=CURRENT_TIMESTAMP
WHERE id=$1::uuid
`, [created.asset.id, principal.userId]);
if (!family) return this.fieldInventory.detail(visitId, created.asset.id, principal);
await this.dataSource.transaction(async (manager) => {
const [current] = await manager.query(`