Fixed auto-export settings set up when importing a JSON file
This commit is contained in:
parent
639d501906
commit
a868087af9
@ -66,19 +66,29 @@ public static class Setup
|
|||||||
// temporary database source by a JSON file.
|
// temporary database source by a JSON file.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
//
|
||||||
// Enable the auto-export feature:
|
// 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:
|
// 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;
|
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});
|
||||||
|
|
||||||
var autoExportFile = await dbContext.Settings.FirstOrDefaultAsync(n => n.Code == SettingNames.AUTO_EXPORT_FILENAME) ?? new Setting { Code = SettingNames.AUTO_EXPORT_FILENAME };
|
if(await dbContext.Settings.FirstOrDefaultAsync(n => n.Code == SettingNames.AUTO_EXPORT_FILENAME) is { } autoExportFile)
|
||||||
autoExportFile.TextValue = Path.GetFileName(path2JSONFile);
|
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:
|
// 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,
|
Code = SettingNames.AUTO_EXPORT_SENSITIVE_DATA,
|
||||||
BoolValue = false,
|
BoolValue = false,
|
||||||
|
Loading…
Reference in New Issue
Block a user