feat: import/export system config
This commit is contained in:
@@ -61,7 +61,7 @@ public partial class BulkImporter: IAsyncDisposable
|
||||
importer._system = system;
|
||||
}
|
||||
|
||||
importer._cfg = await repo.GetSystemConfig(system.Id);
|
||||
importer._cfg = await repo.GetSystemConfig(system.Id, conn);
|
||||
|
||||
// Fetch all members in the system and log their names and hids
|
||||
var members = await conn.QueryAsync<PKMember>("select id, hid, name from members where system = @System",
|
||||
|
@@ -30,6 +30,20 @@ public partial class BulkImporter
|
||||
|
||||
await _repo.UpdateSystem(_system.Id, patch, _conn);
|
||||
|
||||
var configPatch = new SystemConfigPatch();
|
||||
|
||||
if (importFile.ContainsKey("config"))
|
||||
configPatch = SystemConfigPatch.FromJson(importFile.Value<JObject>("config"));
|
||||
|
||||
if (importFile.ContainsKey("timezone"))
|
||||
configPatch.UiTz = importFile.Value<string>("timezone");
|
||||
|
||||
configPatch.AssertIsValid();
|
||||
if (configPatch.Errors.Count > 0)
|
||||
throw new ImportException($"Field config.{patch.Errors[0].Key} in export file is invalid.");
|
||||
|
||||
await _repo.UpdateSystemConfig(_system.Id, configPatch, _conn);
|
||||
|
||||
var members = importFile.Value<JArray>("members");
|
||||
var groups = importFile.Value<JArray>("groups");
|
||||
var switches = importFile.Value<JArray>("switches");
|
||||
|
Reference in New Issue
Block a user