reflow-project / weloop

WeLoop is a React/TypeScript client for ZenPub and a key component of ReflowOS
https://weloop.reflowproject.eu
GNU Affero General Public License v3.0
5 stars 5 forks source link

Updating the name and the location of an existing resource does not work #113

Closed sbocconi closed 3 years ago

sbocconi commented 3 years ago

I created using the api explorer the following resource:

https://weloop.reflowproject.eu/resource/01FDYCSJ9DC52JZ16MN2N0B0Q1

I then tried to update name, location and the note. Only the note update was successful, I could not update the name and the location.

viktorsmari commented 3 years ago

@sbocconi and if you try to update via the API explorer using a graphql mutation, does that work?

I think I ran into the same problem but cannot find the GitHub issue I thought I had created for it..

sbocconi commented 3 years ago

If I look at the network monitor of the api call from the popup window in Weloop I see two POSTs with the following Request Payloads, in the first:

{
    "operationName": "updateEconomicResource",
    "variables": {
        "id": "01FDYDE9QDWHWJV6BGENV8CJ1V",
        "note": "Inserted with the correct unity only"
    },
    "query": "mutation updateEconomicResource($id: ID!, $note: String, $image: URI) {\n  updateEconomicResource(resource: {id: $id, note: $note, image: $image}) {\n    economicResource {\n      id\n      __typename\n    }\n    __typename\n  }\n}\n"
}

and in the second:

{
    "operationName": "economicResource",
    "variables": {
        "id": "01FDYDE9QDWHWJV6BGENV8CJ1V"
    },
    "query": "query economicResource($id: ID!) {\n  economicResource(id: $id) {\n    id\n    trackingIdentifier\n    primaryAccountable {\n      id\n      name\n      image\n      relationshipsAsObject {\n        id\n        relationship {\n          id\n          inverseRoleLabel\n          __typename\n        }\n        __typename\n      }\n      __typename\n    }\n    name\n    note\n    image\n    stage {\n      id\n      name\n      note\n      __typename\n    }\n    contains {\n      image\n      track {\n        id\n        action {\n          id\n          __typename\n        }\n        fulfills {\n          effortQuantity {\n            id\n            hasUnit {\n              id\n              label\n              symbol\n              __typename\n            }\n            __typename\n          }\n          __typename\n        }\n        __typename\n      }\n      __typename\n    }\n    stage {\n      id\n      name\n      note\n      __typename\n    }\n    containedIn {\n      id\n      name\n      trace {\n        id\n        note\n        __typename\n      }\n      track {\n        id\n        note\n        __typename\n      }\n      __typename\n    }\n    currentLocation {\n      id\n      name\n      lat\n      long\n      __typename\n    }\n    lot {\n      id\n      expiryDate\n      batchNumber\n      __typename\n    }\n    trace {\n      id\n      note\n      action {\n        id\n        label\n        __typename\n      }\n      resourceQuantity {\n        id\n        hasUnit {\n          id\n          label\n          __typename\n        }\n        hasNumericalValue\n        __typename\n      }\n      resourceInventoriedAs {\n        id\n        name\n        __typename\n      }\n      toResourceInventoriedAs {\n        id\n        name\n        __typename\n      }\n      provider {\n        id\n        name\n        __typename\n      }\n      receiver {\n        id\n        name\n        __typename\n      }\n      __typename\n    }\n    trace {\n      id\n      note\n      resourceQuantity {\n        id\n        hasUnit {\n          id\n          label\n          __typename\n        }\n        hasNumericalValue\n        __typename\n      }\n      resourceInventoriedAs {\n        id\n        name\n        __typename\n      }\n      toResourceInventoriedAs {\n        id\n        name\n        __typename\n      }\n      action {\n        id\n        label\n        __typename\n      }\n      provider {\n        id\n        name\n        __typename\n      }\n      receiver {\n        id\n        name\n        __typename\n      }\n      __typename\n    }\n    track {\n      id\n      note\n      resourceQuantity {\n        id\n        hasUnit {\n          id\n          label\n          __typename\n        }\n        hasNumericalValue\n        __typename\n      }\n      resourceInventoriedAs {\n        id\n        name\n        __typename\n      }\n      toResourceInventoriedAs {\n        id\n        name\n        __typename\n      }\n      action {\n        id\n        label\n        __typename\n      }\n      provider {\n        id\n        name\n        __typename\n      }\n      receiver {\n        id\n        name\n        __typename\n      }\n      __typename\n    }\n    unitOfEffort {\n      id\n      label\n      __typename\n    }\n    onhandQuantity {\n      id\n      hasNumericalValue\n      hasUnit {\n        id\n        label\n        __typename\n      }\n      __typename\n    }\n    __typename\n  }\n}\n"
}

I do not see where my new name and my new location are sent in the payload.

oksanasalohubova commented 3 years ago
Снимок экрана 2021-10-26 в 11 34 34

I removed the fields for changing Location and Name. API doesn't give us ability to pass this fields

pral2a commented 3 years ago

Fully agree to update unnecessary inputs!