From 9cfc34e19fcebf1a7ec08788d7f723ce0e50f59e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20No=C3=ABl?= Date: Mon, 1 Jun 2020 09:56:53 +0200 Subject: [PATCH] rename findOneWithUsersCount MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pierre Noël --- packages/strapi-admin/controllers/role.js | 2 +- packages/strapi-admin/services/__tests__/role.test.js | 2 +- packages/strapi-admin/services/role.js | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/strapi-admin/controllers/role.js b/packages/strapi-admin/controllers/role.js index fe94d75f75..3644e9f9c4 100644 --- a/packages/strapi-admin/controllers/role.js +++ b/packages/strapi-admin/controllers/role.js @@ -5,7 +5,7 @@ const { validateRoleUpdateInput } = require('../validation/role'); module.exports = { async findOne(ctx) { const { id } = ctx.params; - const role = await strapi.admin.services.role.findOneWithUsersCounts({ id }); + const role = await strapi.admin.services.role.findOneWithUsersCount({ id }); if (!role) { return ctx.notFound('role.notFound'); diff --git a/packages/strapi-admin/services/__tests__/role.test.js b/packages/strapi-admin/services/__tests__/role.test.js index dd847f2989..6319ebbe65 100644 --- a/packages/strapi-admin/services/__tests__/role.test.js +++ b/packages/strapi-admin/services/__tests__/role.test.js @@ -54,7 +54,7 @@ describe('Role', () => { query: () => ({ findOne: dbFindOne, count: dbCount }), }; - const foundRole = await roleService.findOneWithUsersCounts({ id: role.id }); + const foundRole = await roleService.findOneWithUsersCount({ id: role.id }); expect(dbFindOne).toHaveBeenCalledWith({ id: role.id }, []); expect(dbCount).toHaveBeenCalledWith({ 'roles.id': role.id }); diff --git a/packages/strapi-admin/services/role.js b/packages/strapi-admin/services/role.js index 2dc3f90659..c6a164828d 100644 --- a/packages/strapi-admin/services/role.js +++ b/packages/strapi-admin/services/role.js @@ -36,7 +36,7 @@ const findOne = (params = {}, populate = []) => { * @param params query params to find the role * @returns {Promise} */ -const findOneWithUsersCounts = async (params = {}, populate = []) => { +const findOneWithUsersCount = async (params = {}, populate = []) => { const role = await strapi.query('role', 'admin').findOne(params, populate); if (role) { @@ -130,7 +130,7 @@ const deleteByIds = async (ids = []) => { /** Count the number of users for some roles * @param rolesIds - * @returns {Promise} + * @returns {Promise} */ const getUsersCount = async roleId => { return strapi.query('user', 'admin').count({ 'roles.id': roleId }); @@ -140,7 +140,7 @@ module.exports = { sanitizeRole, create, findOne, - findOneWithUsersCounts, + findOneWithUsersCount, find, findAllWithUsersCount, update,