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>
30 lines
1.1 KiB
C#
30 lines
1.1 KiB
C#
namespace Schaad.Accounting
|
|
{
|
|
/// <summary>
|
|
/// Folder layout below DataPath:
|
|
/// <code>
|
|
/// {DataPath}/{mandator}/{year}/*.json data files
|
|
/// {DataPath}/uploads/{mandator}/{year}/ imported bank statements (+ creditCard/)
|
|
/// {DataPath}/backup/{mandator}/{year}/ backup zips and migrated XML files
|
|
/// </code>
|
|
/// </summary>
|
|
public static class DataFolders
|
|
{
|
|
public const string Uploads = "uploads";
|
|
public const string Backup = "backup";
|
|
public const string CreditCard = "creditCard";
|
|
|
|
/// <summary>
|
|
/// True for the top-level folders that are not mandators.
|
|
/// </summary>
|
|
public static bool IsReserved(string folderName)
|
|
=> folderName.Equals(Uploads, System.StringComparison.OrdinalIgnoreCase)
|
|
|| folderName.Equals(Backup, System.StringComparison.OrdinalIgnoreCase);
|
|
|
|
/// <summary>
|
|
/// Year folders are four-digit numbers.
|
|
/// </summary>
|
|
public static bool IsYear(string folderName)
|
|
=> folderName.Length == 4 && int.TryParse(folderName, out _);
|
|
}
|
|
}
|