From 9d25fa05e6d35983ca37578cbfb8034c7c86968b Mon Sep 17 00:00:00 2001 From: stankis <151746694+stankis@users.noreply.github.com> Date: Fri, 8 Dec 2023 13:03:17 +0300 Subject: [PATCH] Renaming in favorites fixes (#37) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Bump version to 0.115.0 [release] * Migration file which adds alias column to favorites table * Update package versions * Added renameFavorite method which updates alias column in favorites table * Extended new Favorite model with alias column * Rename favorite fixes --------- Co-authored-by: GitHub Release <> Co-authored-by: Stanislav Kiselev <“staskis@yandex-team.ru”> --- src/db/models/favorite/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/db/models/favorite/index.ts b/src/db/models/favorite/index.ts index 7c1c29be..cee2419f 100644 --- a/src/db/models/favorite/index.ts +++ b/src/db/models/favorite/index.ts @@ -386,10 +386,13 @@ class Favorite extends Model { validateRenameFavorite({entryId, name}); + const {login} = requestedBy; + const result = await Favorite.query(this.primary) - .where({entryId}) .update({alias: name}) + .where({entryId, tenantId, login}) .returning('*') + .first() .timeout(Model.DEFAULT_QUERY_TIMEOUT); ctx.log('RENAME_FAVORITE_SUCCESS');