Inventory split: InventoryItem entity, schema v2 with tested migration, Lager screen
Stock, package size and prescription state move to inventory_item; medication is now a regimen (itemId FK RESTRICT — deleting a stock item can never silently take adherence history with it). Supply warnings aggregate consumption across all regimens sharing an item. New Lager screen with one-tap '+1 pakning' restock; med editor picks an existing item or creates one inline via the shared ItemFormState (one form, no drift). Backup format v2 mirrors the split and still restores v1 files by performing the same conversion the DB migration does. MIGRATION_1_2 statements are copied from the exported 2.json and proven by an instrumented MigrationTestHelper test on the emulator (validates against the schema AND asserts data survival) before it ever touches the phone's medical record. Heads-up: connectedAndroidTest must target the emulator (ANDROID_SERIAL) — the phone's release signature rejects debug test APKs. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
f8e8dca081
commit
9b5817fcef
27 changed files with 1451 additions and 342 deletions
|
|
@ -18,7 +18,12 @@ class BackupManager(private val context: Context) {
|
|||
/** Plaintext JSON export (caller decides whether/how to encrypt). */
|
||||
suspend fun exportJson(): String {
|
||||
val dao = db.backupDao()
|
||||
return BackupSerializer.export(dao.allMedications(), dao.allDoseTimes(), dao.allDoseLogs())
|
||||
return BackupSerializer.export(
|
||||
dao.allInventoryItems(),
|
||||
dao.allMedications(),
|
||||
dao.allDoseTimes(),
|
||||
dao.allDoseLogs(),
|
||||
)
|
||||
}
|
||||
|
||||
/** Export encrypted with a *typed* passphrase (never stored — manual path). */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue