I need to upload multiple images using a single graphql mutation.
Following official nexus documentation, I managed to use graphql-upload library and got access to upload scalar type as below,
import { GraphQLUpload } from "graphql-upload";
import { asNexusMethod } from "nexus";
export const Upload = asNexusMethod(GraphQLUpload, "upload");
Single upload - working
import { inputObjectType } from "nexus";
export const ProductCreateInputOverride = inputObjectType({
name: "ProductCreateInputOverride",
definition(t) {
t.upload("images");
}
});
Multiple upload - not working
import { inputObjectType } from "nexus";
export const ProductCreateInputOverride = inputObjectType({
name: "ProductCreateInputOverride",
definition(t) {
t.list.upload("images");
}
});
When using t.list.upload("images"), typescript is not showing any errors and gives auto-completion also. But the server start will fail with error "t.list.upload" is not a function.
Is this not the right way to do it ???. Please suggest.