using SqlKata; namespace PluralKit.Core; public partial class ModelRepository { public Task GetSystemConfig(SystemId system, IPKConnection conn = null) => _db.QueryFirst(conn, new Query("system_config").Where("system", system)); public async Task UpdateSystemConfig(SystemId system, SystemConfigPatch patch, IPKConnection conn = null) { var query = patch.Apply(new Query("system_config").Where("system", system)); var config = await _db.QueryFirst(conn, query, "returning *"); _ = _dispatch.Dispatch(system, new UpdateDispatchData { Event = DispatchEvent.UPDATE_SETTINGS, EventData = patch.ToJson() }); return config; } }