From 502265973c0fe93d51099c6d2de0179f782d195d Mon Sep 17 00:00:00 2001 From: spiral Date: Sun, 3 Oct 2021 12:02:26 -0400 Subject: [PATCH] fix: explicitly return * in Patch queries This is needed because the API takes the object from the database query to return to the user --- .../Database/Repository/ModelRepository.Account.cs | 2 +- PluralKit.Core/Database/Repository/ModelRepository.Guild.cs | 6 +++--- .../Database/Repository/ModelRepository.Member.cs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/PluralKit.Core/Database/Repository/ModelRepository.Account.cs b/PluralKit.Core/Database/Repository/ModelRepository.Account.cs index a0c606dc..bba07815 100644 --- a/PluralKit.Core/Database/Repository/ModelRepository.Account.cs +++ b/PluralKit.Core/Database/Repository/ModelRepository.Account.cs @@ -10,7 +10,7 @@ namespace PluralKit.Core { _logger.Information("Updated account {accountId}: {@AccountPatch}", id, patch); var query = patch.Apply(new Query("accounts").Where("uid", id)); - await _db.ExecuteQuery(query); + await _db.ExecuteQuery(query, extraSql: "returning *"); } } } \ No newline at end of file diff --git a/PluralKit.Core/Database/Repository/ModelRepository.Guild.cs b/PluralKit.Core/Database/Repository/ModelRepository.Guild.cs index 538fce39..5eb8ed26 100644 --- a/PluralKit.Core/Database/Repository/ModelRepository.Guild.cs +++ b/PluralKit.Core/Database/Repository/ModelRepository.Guild.cs @@ -17,7 +17,7 @@ namespace PluralKit.Core { _logger.Information("Updated guild {GuildId}: {@GuildPatch}", guild, patch); var query = patch.Apply(new Query("servers").Where("id", guild)); - return _db.ExecuteQuery(query); + return _db.ExecuteQuery(query, extraSql: "returning *"); } @@ -37,7 +37,7 @@ namespace PluralKit.Core { _logger.Information("Updated {SystemId} in guild {GuildId}: {@SystemGuildPatch}", system, guild, patch); var query = patch.Apply(new Query("system_guild").Where("system", system).Where("guild", guild)); - return _db.ExecuteQuery(query); + return _db.ExecuteQuery(query, extraSql: "returning *"); } @@ -57,7 +57,7 @@ namespace PluralKit.Core { _logger.Information("Updated {MemberId} in guild {GuildId}: {@MemberGuildPatch}", member, guild, patch); var query = patch.Apply(new Query("member_guild").Where("member", member).Where("guild", guild)); - return _db.ExecuteQuery(query); + return _db.ExecuteQuery(query, extraSql: "returning *"); } } } \ No newline at end of file diff --git a/PluralKit.Core/Database/Repository/ModelRepository.Member.cs b/PluralKit.Core/Database/Repository/ModelRepository.Member.cs index 646a5235..d2cf4e4f 100644 --- a/PluralKit.Core/Database/Repository/ModelRepository.Member.cs +++ b/PluralKit.Core/Database/Repository/ModelRepository.Member.cs @@ -64,7 +64,7 @@ namespace PluralKit.Core { _logger.Information("Updated {MemberId}: {@MemberPatch}", id, patch); var query = patch.Apply(new Query("members").Where("id", id)); - return _db.QueryFirst(conn, query); + return _db.QueryFirst(conn, query, extraSql: "returning *"); } public Task DeleteMember(MemberId id)