You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Do you want to request a feature or report a bug?
bug What is the current behavior?
upload plugin is missing mutation multipleUpload, i tried editing the schema.graphql , if i pass the files variables the request is stuck in pending
const _ = require('lodash');
module.exports = {
mutation: `
upload(refId: ID, ref: String, source: String, file: Upload!): UploadFile!,
multipleUpload(refId: ID, ref: String, source: String, files: [Upload!]): [UploadFile!]
`,
resolver: {
Query: {
file: false,
files: {
description: 'Return files uploaded',
resolver: {
plugin: 'upload',
handler: 'Upload.find'
},
}
},
Mutation: {
createFile: false,
updateFile: false,
deleteFile: false,
upload: {
description: 'Upload one file',
resolver: async (obj, { file, ...fields}, { context }) => {
// Construct context to fit with koa-parser guidelines
// and avoid to update our business logic too much.
context.request.body = {
files: {
files: await file
},
fields
};
// Call controller action.
await strapi.plugins.upload.controllers.upload.upload(context);
// Handle case when the user is uploading only one file.
if (_.isArray(context.body) && context.body.length === 1) {
return context.body[0];
}
// Return response.
return context.body;
}
},
multipleUpload: {
description: 'Upload multiple files',
policy: ['plugins.users-permissions.isAuthenticated', 'isOwner'],
resolver: async (obj, { files, ...fields}, { context }) => {
console.log('###multipleUpload')
// Construct context to fit with koa-parser guidelines
// and avoid to update our business logic too much.
context.request.body = {
files: {
files: await files
},
fields
};
// Call controller action.
await strapi.plugins.upload.controllers.upload.upload(context);
// Handle case when the user is uploading only one file.
if (_.isArray(context.body) && context.body.length === 1) {
return context.body[0];
}
// Return response.
return context.body;
}
},
}
}
};
If the current behavior is a bug, please provide the steps to reproduce the problem
What is the expected behavior?
The text was updated successfully, but these errors were encountered:
Node.js version:
v11.2.0
npm version:
6.4.1
Strapi version:
3.0.0-alpha.16
Operating system:
macOS Mojave 10.14.1
Which example is causing problem?
Do you want to request a feature or report a bug?
bug
What is the current behavior?
upload plugin is missing mutation multipleUpload, i tried editing the schema.graphql , if i pass the files variables the request is stuck in pending
If the current behavior is a bug, please provide the steps to reproduce the problem
What is the expected behavior?
The text was updated successfully, but these errors were encountered: