Skip to content
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

Ability to add parent to mutation #199

Open
Hyra opened this issue Dec 7, 2018 · 3 comments
Open

Ability to add parent to mutation #199

Hyra opened this issue Dec 7, 2018 · 3 comments

Comments

@Hyra
Copy link

Hyra commented Dec 7, 2018

When adding an item through a mutation it's only possible to add these native fields, besides any custom fields added to the section:

id: Int
siteId: Int
authorId: Int
title: String
enabled: Boolean
query: MutationQuery

But not other fields such as 'publish date', 'status', 'parent' or 'slug'

Is there a way to add these fields when upserting an item?

Example (trying to add field slug):

mutation {
  upsertProgramsStructureSeasonsDummy(
    title: "Example entry"
    slug: "some-custom-slug"
  ) {
    id
    slug
  }
}
@u12206050
Copy link

In addition...
I really need to be able to mutate the structure articles, meaning I need to define which parent this article should be placed beneath.

mutation {
  upsertBlogCategory(
    title: "Example entry"
    descendantOf: 3 // This needs to work!!!
  ) {
    id
    title
    parent: { // This already works
      title
    }
  }
}

markhuot added a commit that referenced this issue Dec 10, 2018
@markhuot
Copy link
Owner

These changes will make it in to the next release, a few notes though,

  1. Instead of publish date try postDate and see if that gets you what you're looking for
  2. status is a read-only (computed) field based on the enabled flag and the postDate check. You can't actually set the status
  3. parent will be implemented with the new parentId: attribute since that's how it is referred to internally within the Craft 3 API
  4. slug will be implemented with the new slug: attribute

@markhuot
Copy link
Owner

I forgot to add #199 in to my commit message for the parentId: attribute. Here is the code change that will go out with the next release,

c9ee811

seamofreality pushed a commit to djfarly/craftql that referenced this issue Jul 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants