From 5c65314162a8e3d821cf9346ad454828306a7de1 Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 27 Oct 2022 09:27:50 +0200 Subject: [PATCH] use findById --- back/methods/account/privileges.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/back/methods/account/privileges.js b/back/methods/account/privileges.js index f3f500e7d..d3aa9bf59 100644 --- a/back/methods/account/privileges.js +++ b/back/methods/account/privileges.js @@ -44,16 +44,13 @@ module.exports = Self => { if (!user.hasGrant) throw new UserError(`You don't have grant privilege`); - const [userToUpdate] = await models.Account.find({ + const userToUpdate = await models.Account.findById(id, { fields: ['id', 'name', 'hasGrant', 'roleFk', 'password'], include: { relation: 'role', scope: { fields: ['name'] } - }, - where: { - id: id } }, myOptions);