Skip to content
This repository was archived by the owner on Sep 16, 2025. It is now read-only.

Commit 27b69ff

Browse files
refactor(getPluginService): remove unnecessary param for strapi
1 parent c48e13f commit 27b69ff

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

server/controllers/slug-controller.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const { hasRequiredModelScopes } = require('../utils/hasRequiredModelScopes');
1010

1111
module.exports = ({ strapi }) => ({
1212
async findSlug(ctx) {
13-
const { models } = getPluginService(strapi, 'settingsService').get();
13+
const { models } = getPluginService('settingsService').get();
1414
const { modelName, slug } = ctx.request.params;
1515
const { auth } = ctx.state;
1616

@@ -36,7 +36,7 @@ module.exports = ({ strapi }) => ({
3636
query.publicationState = 'live';
3737
}
3838

39-
const data = await getPluginService(strapi, 'slugService').findOne(uid, query);
39+
const data = await getPluginService('slugService').findOne(uid, query);
4040

4141
if (data) {
4242
const sanitizedEntity = await sanitizeOutput(data, contentType, auth);

server/graphql/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const registerGraphlQLQuery = (strapi) => {
1111
resolversConfig: getResolversConfig(),
1212
});
1313

14-
getPluginService(strapi, 'extension', 'graphql').use(extension);
14+
getPluginService('extension', 'graphql').use(extension);
1515
};
1616

1717
module.exports = {

server/graphql/types.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ const { hasRequiredModelScopes } = require('../utils/hasRequiredModelScopes');
55
const { sanitizeOutput } = require('../utils/sanitizeOutput');
66

77
const getCustomTypes = (strapi, nexus) => {
8-
const { naming } = getPluginService(strapi, 'utils', 'graphql');
9-
const { toEntityResponse } = getPluginService(strapi, 'format', 'graphql').returnTypes;
10-
const { models } = getPluginService(strapi, 'settingsService').get();
8+
const { naming } = getPluginService('utils', 'graphql');
9+
const { toEntityResponse } = getPluginService('format', 'graphql').returnTypes;
10+
const { models } = getPluginService('settingsService').get();
1111
const { getEntityResponseName } = naming;
1212

1313
// get all types required for findSlug query
@@ -50,7 +50,7 @@ const getCustomTypes = (strapi, nexus) => {
5050
publicationState: nexus.stringArg('The publication state of the entry'),
5151
},
5252
resolve: async (_parent, args, ctx) => {
53-
const { models } = getPluginService(strapi, 'settingsService').get();
53+
const { models } = getPluginService('settingsService').get();
5454
const { modelName, slug, publicationState } = args;
5555
const { auth } = ctx.state;
5656

@@ -77,7 +77,7 @@ const getCustomTypes = (strapi, nexus) => {
7777
query.publicationState = publicationState || 'live';
7878
}
7979

80-
const data = await getPluginService(strapi, 'slugService').findOne(uid, query);
80+
const data = await getPluginService('slugService').findOne(uid, query);
8181
const sanitizedEntity = await sanitizeOutput(data, contentType, auth);
8282
return toEntityResponse(sanitizedEntity, { resourceUID: uid });
8383
},

server/utils/getPluginService.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const { pluginId } = require('./pluginId');
77
*
88
* @return service
99
*/
10-
const getPluginService = (strapi, name, plugin = pluginId) => strapi.plugin(plugin).service(name);
10+
const getPluginService = (name, plugin = pluginId) => strapi.plugin(plugin).service(name);
1111

1212
module.exports = {
1313
getPluginService,

0 commit comments

Comments
 (0)