Database / Land & assets

inventoryproduct

One product (seed, input) held in a farmer's inventory with quantity and unit.

Table factsheetagri_db
Written by
  • Legacy setup (InventoryProductDTO)
  • Data setup (Setup.kt, SetupForUser via SetupService.getInventoryProduct)
  • Inventory screen via BridgeSyncHelper (createInventoryProduct, updateInventoryProduct)
Read by
  • InventoryProductWorker (sync)
  • BridgeSyncHelper
Filled from
POST api/setupdata/v2 (InventoryProductDTO)
GET /ctld/api/inventory/inventoryproduct/v1
Sync
appId is a client UUID primary key. syncStatus starts at SYNC_DONE for downloaded rows, becomes SYNC_NOT_INITIALIZED when the row is created or edited on the device, and goes back to SYNC_DONE when the response handler writes the server id. opId holds the id of the last queued library operation. Sync entity INVENTORY_PRODUCT (POST, PATCH). Depends on the parent INVENTORY operation.
Source
data/src/main/java/org/mindtree/app/agricultor/data/entity/InventoryProduct.kt

Columns

ColumnTypeNullKeyMeaning
usableQuantityINTEGERYesInteger part of the entered quantity (the app sends the same value as quantity).
notesTEXTYesFractional part of the entered quantity as text (e.g. "0.5"), because quantity is an integer. Added back when read.
aliasIdTEXTYesBusiness alias (stable cross-system id).
quantityINTEGERYesTotal quantity.
idINTEGERYesServer id. Null or 0 until the row is synced.
isActiveINTEGERYesSoft-delete flag (1 = active).
appIdTEXTNoPKClient-side UUID. Defaults to a random UUID when the object is built, including when server JSON is parsed.
opIdTEXTYesId of the last queued operation in the library queue (SYNC_QUEUE_DB).
syncStatusTEXTNoSYNC_NOT_INITIALIZED | IN_SYNC_QUEUE | SYNC_DONE (default).
quantityInUOM_idINTEGERYesUnit of measure detail (flattened embedded DTO).
quantityInUOM_valueREALYesNumeric quantity value (flattened embedded quantity).
quantityInUOM_uom_symbolTEXTYesUnit of measure detail (flattened embedded DTO).
quantityInUOM_uom_codeTEXTYesUnit of measure detail (flattened embedded DTO).
quantityInUOM_uom_unitNameTEXTYesUnit of measure detail (flattened embedded DTO).
quantityInUOM_uom_measurementtype_labelTEXTYesUnit of measure detail (flattened embedded DTO).
quantityInUOM_uom_measurementtype_dataCodeTEXTYesUnit of measure detail (flattened embedded DTO).
quantityInUOM_uom_measurementtype_globalrefclass_classCodeTEXTYesUnit of measure detail (flattened embedded DTO).
quantityInUOM_uom_measurementtype_globalrefclass_nameTEXTYesUnit of measure detail (flattened embedded DTO).
quantityInUOM_uom_measurementtype_language_languageTEXTYesLanguage name.
quantityInUOM_uom_measurementtype_language_languageCodeTEXTYesLanguage code (ENG, TEL, ...).
productsku_idINTEGERYesFK → product_productsku.idServer id of the embedded object. Link by convention only, no FK constraint.
uom_symbolTEXTYesUnit of measure detail (flattened embedded DTO).
uom_codeTEXTYesUnit of measure detail (flattened embedded DTO).
uom_unitNameTEXTYesUnit of measure detail (flattened embedded DTO).
uom_measurementtype_labelTEXTYesUnit of measure detail (flattened embedded DTO).
uom_measurementtype_dataCodeTEXTYesUnit of measure detail (flattened embedded DTO).
uom_measurementtype_globalrefclass_classCodeTEXTYesUnit of measure detail (flattened embedded DTO).
uom_measurementtype_globalrefclass_nameTEXTYesUnit of measure detail (flattened embedded DTO).
uom_measurementtype_language_languageTEXTYesLanguage name.
uom_measurementtype_language_languageCodeTEXTYesLanguage code (ENG, TEL, ...).
inventory_owningEnitityIdINTEGERYesOwner farmer id (column name typo "Enitity").
inventory_notesTEXTYesNo description in code.
inventory_owningEntityTypeTEXTYesNo description in code.
inventory_nameTEXTYesOwner name sent with the product: farmer's full name, or the logged-in user's first name for a user-owned inventory.
inventory_idINTEGERYesFK → inventory.idServer id of the embedded object. Link by convention only, no FK constraint.
inventory_isActiveINTEGERYesActive flag of the embedded object.
inventory_supervisor_isActiveINTEGERYesActive flag of the embedded object.
inventory_supervisor_idINTEGERYesServer id of the embedded object.
inventory_supervisor_aliasIdTEXTYesFarmer alias (ie.aliasId) of the owner, or the user id for a user-owned inventory.
inventory_supervisor_actorIdTEXTYesFarmer server id of the owner (ACTOR_TYPE.IE), or the user id for a user-owned inventory (ACTOR_TYPE.USER).
inventory_supervisor_actortype_dataCodeTEXTYesReference data code.
inventory_supervisor_actortype_globalrefclass_classCodeTEXTYesReference class of the code (flattened embedded DTO).
inventory_supervisor_actortype_language_languageCodeTEXTYesLanguage code (ENG, TEL, ...).
appmill_metadata_ie_appIdTEXTYesFK → ie.appIdLocal appId of the owning farmer (ie.appId). Used to link rows before the farmer has a server id. Link by convention only, no FK constraint.

Notes

  • Around 44 columns because the parent inventory, its supervisor and two units of measure are flattened into each row.
  • The inventory screen itself reads the legacy ie_inventory table.