feat(inventory): mark field-created records as real instances
This commit is contained in:
@@ -122,7 +122,16 @@ export class F3FieldInventoryStructureService {
|
|||||||
asset: { id: string; code: string; name: string };
|
asset: { id: string; code: string; name: string };
|
||||||
[key: string]: unknown;
|
[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) => {
|
await this.dataSource.transaction(async (manager) => {
|
||||||
const [current] = await manager.query(`
|
const [current] = await manager.query(`
|
||||||
|
|||||||
Reference in New Issue
Block a user