diff --git a/PluralKit.API/Controllers/v2/SwitchControllerV2.cs b/PluralKit.API/Controllers/v2/SwitchControllerV2.cs index 2e580d99..7ff5ea0c 100644 --- a/PluralKit.API/Controllers/v2/SwitchControllerV2.cs +++ b/PluralKit.API/Controllers/v2/SwitchControllerV2.cs @@ -183,7 +183,7 @@ public class SwitchControllerV2: PKControllerBase if (await _repo.GetSwitches(system.Id).Select(x => x.Timestamp).ContainsAsync(value)) throw Errors.SameSwitchTimestampError; - await _repo.MoveSwitch(sw.Id, value); + sw = await _repo.MoveSwitch(sw.Id, value); var members = await _db.Execute(conn => _repo.GetSwitchMembers(conn, sw.Id)).ToListAsync(); return Ok(new FrontersReturnNew diff --git a/PluralKit.Core/Database/Repository/ModelRepository.Switch.cs b/PluralKit.Core/Database/Repository/ModelRepository.Switch.cs index 4b3988bd..11d5592b 100644 --- a/PluralKit.Core/Database/Repository/ModelRepository.Switch.cs +++ b/PluralKit.Core/Database/Repository/ModelRepository.Switch.cs @@ -92,11 +92,11 @@ public partial class ModelRepository _logger.Information("Updated {SwitchId} members: {Members}", switchId, members); } - public async Task MoveSwitch(SwitchId id, Instant time) + public async Task MoveSwitch(SwitchId id, Instant time) { _logger.Information("Updated {SwitchId} timestamp: {SwitchTimestamp}", id, time); var query = new Query("switches").AsUpdate(new { timestamp = time }).Where("id", id); - await _db.ExecuteQuery(query); + var ret = await _db.QueryFirst(query, extraSql: "returning *"); _ = _dispatch.Dispatch(id, new UpdateDispatchData { Event = DispatchEvent.UPDATE_SWITCH, @@ -105,6 +105,7 @@ public partial class ModelRepository timestamp = time.FormatExport(), }), }); + return ret; } public async Task DeleteSwitch(SwitchId id)