postgraphile-plugin-nested-mutations icon indicating copy to clipboard operation
postgraphile-plugin-nested-mutations copied to clipboard

Issue updating 3rd nested level

Open francescovenica opened this issue 3 years ago • 2 comments

Hello,

I have a problem with a nested mutation but I'm not sure if I'm missing something or if it can't work, this is the schema I have:

CREATE TABLE media (
  uuid uuid PRIMARY KEY DEFAULT uuid_generate_v4 (),
  url text,
  alt text
);

CREATE TABLE media_gallery (
  uuid uuid PRIMARY KEY DEFAULT uuid_generate_v4 ()
);

CREATE TABLE media_gallery_item (
  uuid uuid PRIMARY KEY DEFAULT uuid_generate_v4 (),
  gallery_uuid uuid NOT NULL REFERENCES media_gallery (uuid) ON DELETE CASCADE,
  media_uuid uuid NOT NULL REFERENCES media (uuid) ON DELETE CASCADE,
  title text
);

and this is the body I'm sending:

{
    "input": {
      "patch": {
        "mediaGalleryItems": {
          "updateByUuid": [
            {
              "uuid": "938449fd-7173-42f5-b973-94c48fc61f81",
              "patch": {
                "title": "rewq 123",
                "media": {
                  "updateByUuid": {
                    "uuid": "a5d08fc0-30ea-44a3-a379-20bbb3a703e0",
                    "patch": { "alt": "ciao" }
                  }
                }
              }
            }
          ]
        }
      },
      "uuid": "09248c26-864e-46a0-8e0b-7ab0a69f2e59"
    }
  }

the title rewq 123 work fine, the alt doesn't....am I missing something?

many thanks

francescovenica avatar Jun 05 '21 00:06 francescovenica

From what I've seen in the code, there is no recursion involved with nested updaters and deleters, only with create, but that would definitely be a nice feature, especially since the inflectors are suggesting it might work.

Eldow avatar Jun 25 '21 09:06 Eldow

It actually comes down to the same issue as #29.

Eldow avatar Jun 28 '21 07:06 Eldow