mirror of
https://github.com/strapi/strapi.git
synced 2025-11-02 10:55:37 +00:00
Cleanup feedbacks
Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com>
This commit is contained in:
parent
5723af75c5
commit
04f6050ae1
@ -7,8 +7,6 @@ module.exports = {
|
||||
testQuery: {
|
||||
policies: ['plugins::users-permissions.isAuthenticated'],
|
||||
resolver: 'application::homepage.homepage.find',
|
||||
// resolver: 'homepage.homepage.find'
|
||||
// resolver: 'homepage.find'
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@ -4,11 +4,10 @@ module.exports = {
|
||||
`,
|
||||
resolver: {
|
||||
Mutation: {
|
||||
// updateUser: {
|
||||
// description: 'Updates a user',
|
||||
// policies: ['customPolicy'],
|
||||
// resolver: 'plugins::users-permissions.user.update',
|
||||
// },
|
||||
updateUser: {
|
||||
description: 'Updates a user',
|
||||
policies: ['customPolicy'],
|
||||
},
|
||||
},
|
||||
Query: {
|
||||
userCustomRoute: {
|
||||
|
||||
@ -34,12 +34,11 @@ const buildMutation = (mutationName, config) => {
|
||||
const action = getAction(resolver);
|
||||
|
||||
return async (root, options = {}, graphqlContext) => {
|
||||
const { context } = graphqlContext;
|
||||
const ctx = buildMutationContext({ options, graphqlContext });
|
||||
|
||||
await policiesMiddleware(ctx);
|
||||
|
||||
const values = await action(context);
|
||||
const values = await action(ctx);
|
||||
const result = ctx.body || values;
|
||||
|
||||
if (_.isError(result)) {
|
||||
@ -53,23 +52,23 @@ const buildMutation = (mutationName, config) => {
|
||||
const buildMutationContext = ({ options, graphqlContext }) => {
|
||||
const { context } = graphqlContext;
|
||||
|
||||
if (options.input && options.input.where) {
|
||||
context.params = convertToParams(options.input.where || {});
|
||||
} else {
|
||||
context.params = {};
|
||||
}
|
||||
|
||||
if (options.input && options.input.data) {
|
||||
context.request.body = options.input.data || {};
|
||||
} else {
|
||||
context.request.body = options;
|
||||
}
|
||||
|
||||
const ctx = context.app.createContext(
|
||||
_.clone(context.req),
|
||||
_.clone(context.res)
|
||||
);
|
||||
|
||||
if (options.input && options.input.where) {
|
||||
ctx.params = convertToParams(options.input.where || {});
|
||||
} else {
|
||||
ctx.params = {};
|
||||
}
|
||||
|
||||
if (options.input && options.input.data) {
|
||||
ctx.request.body = options.input.data || {};
|
||||
} else {
|
||||
ctx.request.body = options;
|
||||
}
|
||||
|
||||
return ctx;
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user