compact_block
Compact block: a cluster of farmers' plots managed together.
Table factsheetagri_db
- Written by
- Unit data down-sync per VO (
UnitDataSetupViewModel,SetupForUnitInChargeLogin->Repo.saveCompactBlock) - Create/edit block (
CompactBlockViewModel,CompactBlockFarmersFragment,BridgeSyncHelper->insertCompactBlock) - Response handlers
CompactBlockPost/Patch/DeleteRH
- Unit data down-sync per VO (
- Read by
- Compact block screens (
getAllCompactBlockWithAllData)
- Compact block screens (
- Filled from
GET gateway/portfolio-service/api/v1/compact-block/filterGET gateway/portfolio-service/api/v1/compact-block?direction=desc- 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 COMPACT_BLOCK.
- Source
- data/src/main/java/org/mindtree/app/agricultor/data/entity/CompactBlock.kt
Columns
| Column | Type | Null | Key | Meaning |
|---|---|---|---|---|
id | INTEGER | Yes | Server id. Null or 0 until the row is synced. | |
name | TEXT | Yes | Block name. | |
compactBlockCreatedAt | TEXT | Yes | Server create time. | |
compactBlockLastUpdateAt | TEXT | Yes | Server update time. | |
titleId | TEXT | Yes | Index | Stable business key shared by all versions of the record. Index: unique. |
note | TEXT | Yes | Free note. | |
active | INTEGER | Yes | Soft-delete flag (1 = active). | |
inActiveReason | TEXT | Yes | Reason given when the row was deactivated. | |
createdByApp | INTEGER | Yes | Audit: app that created/last changed the row. | |
lastModifiedByApp | INTEGER | Yes | Audit: app that created/last changed the row. | |
createdFromDevice | TEXT | Yes | Audit: device id that created/last changed the row. | |
lastUpdatedFromDevice | TEXT | Yes | Audit: device id that created/last changed the row. | |
appId | TEXT | No | PK | Client-side UUID. Defaults to a random UUID when the object is built, including when server JSON is parsed. |
opId | TEXT | Yes | Id of the last queued operation in the library queue (SYNC_QUEUE_DB). | |
syncStatus | TEXT | No | SYNC_NOT_INITIALIZED | IN_SYNC_QUEUE | SYNC_DONE (default). |
Notes
- getAllCompactBlockWithAllData: active blocks, newest first, with members joined by titleId.
- disabledCompactBlock soft-deletes by titleId.
- Possible bug · unverified saveCompactBlock uses insert(List) = IGNORE on conflict, so existing blocks are never refreshed from the server.