Store data as JSON in a {mandator}/{year} layout, with startup migration #2

Merged
clayschaad merged 3 commits from json-storage into main 2026-10-22 12:00:17 +00:00

3 commits

Author SHA1 Message Date
cbc1cd3f1f Restructure data folder to {mandator}/{year}, uploads and backup at root
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>
2026-10-22 13:57:58 +02:00
acf6753d07 Use PascalCase property names in JSON data files
Property names now match the C# models (BankTransactionText instead of
bankTransactionText). Reading stays case-insensitive. The migrator test now
checks casing case-sensitively; Shouldly's ShouldContain ignores case by
default, so it never actually checked it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 13:44:24 +02:00
24bdfe60bc Store data as JSON instead of XML, with startup migration
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>
2026-10-22 13:34:23 +02:00