Yorkshireman / my-wordlist-mobile

react-native (expo) app backed by authentication-server and my-wordlist-graphql. Project board: https://github.com/users/Yorkshireman/projects/2
1 stars 0 forks source link

Refactor to use CreateWordlistEntries mutation #18

Closed Yorkshireman closed 11 months ago

Yorkshireman commented 1 year ago
mutation WordlistEntriesCreate($wordlistEntries: [WordlistEntryInput!]!) {
  authToken
  wordlistEntriesCreate(wordlistEntries: $wordlistEntries) {
    wordlistEntries {
      categories {
        id
        name
      }
      createdAt
      id
      wordId
      wordlistId
      word {
        createdAt
        id
        text
      }
    }
  }
}

variables:

{
  "wordlistEntries": [
    {
      "word":{
        "text": "chair"
      }
    },
    {
      "word": {
        "text": "book"
      },
      "categories": [
        { "name": "household" }
      ]
    }
  ]
}

response:

{
  "data": {
    "wordlistEntriesCreate": {
      "wordlistEntries": [
        {
          "categories": [],
          "createdAt": "2023-10-11T23:03:06Z",
          "id": "28f36897-4c15-4047-b572-1a1fdb470a50",
          "wordId": "443c7614-1f44-4792-b3a8-985a09379ebd",
          "wordlistId": "de728808-3df2-4dfc-adf9-5981ee5f795a",
          "word": {
            "createdAt": "2023-06-25T16:44:28Z",
            "id": "443c7614-1f44-4792-b3a8-985a09379ebd",
            "text": "chair"
          }
        },
        {
          "categories": [
            {
              "id": "f6c0fc6f-3b01-4059-9588-ccb2bda39d23",
              "name": "household"
            }
          ],
          "createdAt": "2023-10-11T23:03:06Z",
          "id": "4fd0f8e0-1c83-4ed4-a47a-a86ccc5abba2",
          "wordId": "e7547b6d-bae4-4b7a-989a-a5a05c96dbee",
          "wordlistId": "de728808-3df2-4dfc-adf9-5981ee5f795a",
          "word": {
            "createdAt": "2023-10-11T23:03:06Z",
            "id": "4fd0f8e0-1c83-4ed4-a47a-a86ccc5abba2",
            "text": "book"
          }
        }
      ]
    }
  }
}
Yorkshireman commented 11 months ago

PR: https://github.com/Yorkshireman/my-wordlist-mobile/pull/25