Resolve "ASCII export and import for Git" #83

Merged
thorsten merged 30 commits from 48-ascii-export-and-import-for-git into main 2023-02-12 12:55:07 +00:00
Showing only changes of commit a868087af9 - Show all commits

View File

@ -66,19 +66,29 @@ public static class Setup
// temporary database source by a JSON file.
//
//
// Enable the auto-export feature:
var autoExportEnabled = await dbContext.Settings.FirstOrDefaultAsync(n => n.Code == SettingNames.AUTO_EXPORT_ENABLED) ?? new Setting { Code = SettingNames.AUTO_EXPORT_ENABLED };
autoExportEnabled.BoolValue = true;
//
if (await dbContext.Settings.FirstOrDefaultAsync(n => n.Code == SettingNames.AUTO_EXPORT_ENABLED) is { } autoExportEnabled)
autoExportEnabled.BoolValue = true;
else
dbContext.Settings.Add(new Setting {Code = SettingNames.AUTO_EXPORT_ENABLED, BoolValue = true});
//
// Set the auto-export path and file:
var autoExportPath = await dbContext.Settings.FirstOrDefaultAsync(n => n.Code == SettingNames.AUTO_EXPORT_DESTINATION_PATH) ?? new Setting { Code = SettingNames.AUTO_EXPORT_DESTINATION_PATH };
autoExportPath.TextValue = Path.GetDirectoryName(path2JSONFile) ?? string.Empty;
var autoExportFile = await dbContext.Settings.FirstOrDefaultAsync(n => n.Code == SettingNames.AUTO_EXPORT_FILENAME) ?? new Setting { Code = SettingNames.AUTO_EXPORT_FILENAME };
autoExportFile.TextValue = Path.GetFileName(path2JSONFile);
//
if(await dbContext.Settings.FirstOrDefaultAsync(n => n.Code == SettingNames.AUTO_EXPORT_DESTINATION_PATH) is { } autoExportPath)
autoExportPath.TextValue = Path.GetDirectoryName(path2JSONFile) ?? string.Empty;
else
dbContext.Settings.Add(new Setting {Code = SettingNames.AUTO_EXPORT_DESTINATION_PATH, TextValue = Path.GetDirectoryName(path2JSONFile) ?? string.Empty});
if(await dbContext.Settings.FirstOrDefaultAsync(n => n.Code == SettingNames.AUTO_EXPORT_FILENAME) is { } autoExportFile)
autoExportFile.TextValue = Path.GetFileName(path2JSONFile);
else
dbContext.Settings.Add(new Setting {Code = SettingNames.AUTO_EXPORT_FILENAME, TextValue = Path.GetFileName(path2JSONFile)});
// Ensure that the sensitive data setting is present and disabled by default:
var autoExportSensitiveData = await dbContext.Settings.FirstOrDefaultAsync(n => n.Code == SettingNames.AUTO_EXPORT_SENSITIVE_DATA) ?? new Setting
var _ = await dbContext.Settings.FirstOrDefaultAsync(n => n.Code == SettingNames.AUTO_EXPORT_SENSITIVE_DATA) ?? new Setting
{
Code = SettingNames.AUTO_EXPORT_SENSITIVE_DATA,
BoolValue = false,