Store data as JSON in a {mandator}/{year} layout, with startup migration #2
Loading…
Reference in a new issue
No description provided.
Delete branch "json-storage"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
BankTransactionText), null values left out, computed properties (Class,SubClass,IsFxAccount,ReadOnly) not stored. Shared settings live inJsonStorage.DataFolders:SettingsServicebuilds the new paths.GetYearMandatorPath/GetLastYearMandatorPathare removed because they now equal the data paths. The mandator dropdown lists mandators that have a folder for the selected year.DataMigratorruns at startup, before the app serves requests, in two phases:{year}/{mandator}/Data,{year}/{mandator}/uploadsand{year}/backup/{mandator}folders into the new layout, unchanged.{mandator}/{year}folder into JSON, checks that the JSON reads back to the same data, then moves the XML tobackup/{mandator}/{year}/xml-{timestamp}/. Bank-statement XMLs are moved but never converted.CLAUDE.mdupdated for JSON storage and the new layout.Upgrade notes
Test plan
dotnet build: no warningsdotnet test: 77/77 pass, including 15DataMigratorTestShouldtests (old-layout data, uploads with subfolders and year backups moved; XML converted in old and new layout; readable JSON; values round-trip through the repositories; unknown XMLs not converted; rerun does nothing; stray files kept; crash recovery for moves and conversions; conflicting files; corrupt XML) and 4SettingsServiceTestShouldtests for the new paths and mandator list🤖 Generated with Claude Code
Repositories now read and write indented, human-readable JSON (System.Text.Json, shared settings in JsonStorage). File names and folders are unchanged apart from the extension. XmlToJsonMigrator runs at startup before the app serves requests. It converts the known Data/*.xml files under every year/mandator, verifies the JSON reads back to the same data, and moves the XML to {year}/backup/{mandator}/xml-{timestamp}/. Bank-statement XMLs in uploads/ are never touched. Any failure stops startup and leaves that file's XML in place. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>New layout below DataPath (defined in DataFolders): {mandator}/{year}/*.json uploads/{mandator}/{year}/ backup/{mandator}/{year}/ XmlToJsonMigrator becomes DataMigrator with two phases: first move the old {year}/{mandator}/Data, uploads and {year}/backup folders into the new layout unchanged, then convert the XML data files to JSON. Nothing is overwritten; an identical file at the target is dropped, a different one stops startup. Old folders are removed only once empty. SettingsService builds the new paths; GetYearMandatorPath and GetLastYearMandatorPath are removed as they now equal the data paths. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>Store data as JSON instead of XML, with startup migrationto Store data as JSON in a {mandator}/{year} layout, with startup migration