From 08d3684e666e59a5da48de63367898d6eb458408 Mon Sep 17 00:00:00 2001 From: Felix Holmgren Date: Sun, 18 Oct 2020 23:38:03 +0200 Subject: [PATCH] Unique baz_id * foo.barId and foo.bazId become non-optional (Int!) * The root queries for foo disappear - foo(id: Int!) : Foo - fooByBarId(barId: Int!): Foo * The only root query for foo is now foo(bazId: Int!): Foo --- schema.graphql | 25 +++++-------------------- schema.sql | 3 ++- 2 files changed, 7 insertions(+), 21 deletions(-) diff --git a/schema.graphql b/schema.graphql index 294273c..e50e530 100644 --- a/schema.graphql +++ b/schema.graphql @@ -40,22 +40,8 @@ type Baz implements Node { id: Int! name: String - """Reads and enables pagination through a set of `Foo`.""" - foosList( - """Only read the first `n` values of the set.""" - first: Int - - """Skip the first `n` values.""" - offset: Int - - """The method to use when ordering `Foo`.""" - orderBy: [FoosOrderBy!] - - """ - A condition to be used in determining which values should be returned by the collection. - """ - condition: FooCondition - ): [Foo!]! + """Reads a single `Foo` that is related to this `Baz`.""" + foo: Foo } """ @@ -86,8 +72,8 @@ type Foo implements Node { """ nodeId: ID! id: Int! - barId: Int - bazId: Int + barId: Int! + bazId: Int! """Reads a single `Bar` that is related to this `Foo`.""" bar: Bar @@ -202,8 +188,7 @@ type Query implements Node { ): [Foo!] bar(id: Int!): Bar baz(id: Int!): Baz - foo(id: Int!): Foo - fooByBarId(barId: Int!): Foo + foo(bazId: Int!): Foo """Reads a single `Bar` using its globally unique `ID`.""" barByNodeId( diff --git a/schema.sql b/schema.sql index 679ca3b..a8d98f5 100644 --- a/schema.sql +++ b/schema.sql @@ -35,4 +35,5 @@ comment on view gql.baz is '@primaryKey id'; comment on view gql.foo is '@primaryKey id @foreignKey (bar_id) references bar (id) @foreignKey (baz_id) references baz (id) -@unique bar_id'; +@unique bar_id +@unique baz_id';