Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GraphQL API - bulk create entities #1365

Closed
vanhock opened this issue Nov 10, 2022 · 1 comment
Closed

GraphQL API - bulk create entities #1365

vanhock opened this issue Nov 10, 2022 · 1 comment
Labels
status: needs-triage Possible bug which hasn't been reproduced yet

Comments

@vanhock
Copy link

vanhock commented Nov 10, 2022

Bug Report

Hi there!
I tried to extend GraphQL API and create an endpoint that allows generating entities from arrays.

Here is the code:

const productInputType = (GraphQL, fields) => {
  return new GraphQL.GraphQLInputObjectType({
    name: 'ProductInput',
    fields
  })
}

export default buildConfig({
...
graphQL: {
    mutations: (GraphQL, payload) => {
      const createProductScheme = payload.Mutation.fields.createProduct;
      return {
        createProducts: {
          type: new GraphQL.GraphQLList(createProductScheme.type),
          args: {
            productsArray: { type: new GraphQL.GraphQLList(productInputType(GraphQL, createProductScheme.args)) }
          }
        }
      }
    }
  }

Current Behavior

It does not work :(

Expected Behavior

Create multiple entities at one request

Possible Solution

Steps to Reproduce

Detailed Description

@vanhock vanhock added the status: needs-triage Possible bug which hasn't been reproduced yet label Nov 10, 2022
@jmikrut
Copy link
Member

jmikrut commented Nov 12, 2022

Hey @vanhock — this should be totally possible. I'm going to convert this to a discussion because I believe it involves your specific implementation, but we're happy to help you figure this out.

PS - bulk creation / edit / deletion is on our radar for building it into Payload itself. We're very likely to tackle this as our next big feature.

#1382

I can bump it up in priority for you!

@payloadcms payloadcms locked and limited conversation to collaborators Nov 12, 2022
@jmikrut jmikrut converted this issue into discussion #1383 Nov 12, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
status: needs-triage Possible bug which hasn't been reproduced yet
Projects
None yet
Development

No branches or pull requests

2 participants