From 5555d05c499a35851a198ea57f1046be63e213f4 Mon Sep 17 00:00:00 2001 From: Oleg Korzhanov Date: Thu, 25 Apr 2024 01:03:24 +0400 Subject: [PATCH] fix dgraph adapter createUser MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dgraph will generate the ID by itself. In Dgraph, every node has a unique 64-bit identifier that you can expose in GraphQL using the ID type. An ID is auto-generated, immutable and never reused. Each type can have at most one ID field. The ID type works great when you need to use an identifier on nodes and don’t need to set that identifier externally --- packages/adapter-dgraph/src/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/adapter-dgraph/src/index.ts b/packages/adapter-dgraph/src/index.ts index 2b240e26f1..da2f7d3e20 100644 --- a/packages/adapter-dgraph/src/index.ts +++ b/packages/adapter-dgraph/src/index.ts @@ -50,6 +50,7 @@ export function DgraphAdapter( const fragments = { ...defaultFragments, ...options?.fragments } return { async createUser(input) { + if (input?.id) { delete (input.id) } // Dgraph will generate the ID by itself const result = await c.run<{ user: any[] }>( /* GraphQL */ ` mutation ($input: [AddUserInput!]!) {