Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Junction filters #40

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

This Graphile Engine plugin adds connection fields for many-to-many relations.

> Requires `postgraphile@^4.4.0` or `graphile-build-pg@^4.4.0`
> Requires `postgraphile@^4.5.0` or `graphile-build-pg@^4.5.0`

Example:

Expand Down
29 changes: 29 additions & 0 deletions __tests__/integration/schema/__snapshots__/b.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ type Bar implements Node {
"""Only read the first \`n\` values of the set."""
first: Int

"""
A condition to be used in determining which values should be returned by the collection.
"""
junctionCondition: BarFoosByJunctionJBarIdAndJFooIdManyToManyCondition

"""Only read the last \`n\` values of the set."""
last: Int

Expand Down Expand Up @@ -59,6 +64,14 @@ type Bar implements Node {
nodeId: ID!
}

"""
A condition to be used against \`Foo\` object types. All fields are tested for equality and combined with a logical ‘and.’
"""
input BarFoosByJunctionJBarIdAndJFooIdManyToManyCondition {
"""Checks for equality with the \`Junction\` object’s \`createdAt\` field."""
createdAt: Datetime
}

"""A connection to a list of \`Foo\` values, with data from \`Junction\`."""
type BarFoosByJunctionJBarIdAndJFooIdManyToManyConnection {
"""
Expand Down Expand Up @@ -142,6 +155,11 @@ type Foo implements Node {
"""Read all values in the set before (above) this cursor."""
before: Cursor

"""
A condition to be used in determining which values should be returned by the collection.
"""
condition: FooBarsByJunctionJFooIdAndJBarIdManyToManyCondition

"""Only read the first \`n\` values of the set."""
first: Int

Expand Down Expand Up @@ -190,6 +208,17 @@ type Foo implements Node {
nodeId: ID!
}

"""
A condition to be used against \`Bar\` object types. All fields are tested for equality and combined with a logical ‘and.’
"""
input FooBarsByJunctionJFooIdAndJBarIdManyToManyCondition {
"""Checks for equality with the \`Bar\` object’s \`barName\` field."""
barName: String

"""Checks for equality with the \`Junction\` object’s \`createdAt\` field."""
createdAt: Datetime
}

"""A connection to a list of \`Bar\` values, with data from \`Junction\`."""
type FooBarsByJunctionJFooIdAndJBarIdManyToManyConnection {
"""
Expand Down
26 changes: 26 additions & 0 deletions __tests__/integration/schema/__snapshots__/c.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ type Bar implements Node {
"""Only read the first \`n\` values of the set."""
first: Int

"""
A condition to be used in determining which values should be returned by the collection.
"""
junctionCondition: BarFoosByJunctionJBarIdAndJFooIdManyToManyCondition

"""Only read the last \`n\` values of the set."""
last: Int

Expand Down Expand Up @@ -59,6 +64,14 @@ type Bar implements Node {
nodeId: ID!
}

"""
A condition to be used against \`Foo\` object types. All fields are tested for equality and combined with a logical ‘and.’
"""
input BarFoosByJunctionJBarIdAndJFooIdManyToManyCondition {
"""Checks for equality with the \`Junction\` object’s \`id\` field."""
id: Int
}

"""A connection to a list of \`Foo\` values, with data from \`Junction\`."""
type BarFoosByJunctionJBarIdAndJFooIdManyToManyConnection {
"""
Expand Down Expand Up @@ -161,6 +174,11 @@ type Foo implements Node {
"""Only read the first \`n\` values of the set."""
first: Int

"""
A condition to be used in determining which values should be returned by the collection.
"""
junctionCondition: FooBarsByJunctionJFooIdAndJBarIdManyToManyCondition

"""Only read the last \`n\` values of the set."""
last: Int

Expand Down Expand Up @@ -206,6 +224,14 @@ type Foo implements Node {
nodeId: ID!
}

"""
A condition to be used against \`Bar\` object types. All fields are tested for equality and combined with a logical ‘and.’
"""
input FooBarsByJunctionJFooIdAndJBarIdManyToManyCondition {
"""Checks for equality with the \`Junction\` object’s \`id\` field."""
id: Int
}

"""A connection to a list of \`Bar\` values, with data from \`Junction\`."""
type FooBarsByJunctionJFooIdAndJBarIdManyToManyConnection {
"""
Expand Down
32 changes: 32 additions & 0 deletions __tests__/integration/schema/__snapshots__/d.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ type Bar implements Node {
"""Only read the first \`n\` values of the set."""
first: Int

"""
A condition to be used in determining which values should be returned by the collection.
"""
junctionCondition: BarFoosByJunctionJBarIdAndJFooIdManyToManyCondition

"""Only read the last \`n\` values of the set."""
last: Int

Expand Down Expand Up @@ -59,6 +64,17 @@ type Bar implements Node {
nodeId: ID!
}

"""
A condition to be used against \`Foo\` object types. All fields are tested for equality and combined with a logical ‘and.’
"""
input BarFoosByJunctionJBarIdAndJFooIdManyToManyCondition {
"""Checks for equality with the \`Junction\` object’s \`createdAt\` field."""
createdAt: Datetime

"""Checks for equality with the \`Junction\` object’s \`id\` field."""
id: Int
}

"""A connection to a list of \`Foo\` values, with data from \`Junction\`."""
type BarFoosByJunctionJBarIdAndJFooIdManyToManyConnection {
"""
Expand Down Expand Up @@ -167,6 +183,11 @@ type Foo implements Node {
"""Only read the first \`n\` values of the set."""
first: Int

"""
A condition to be used in determining which values should be returned by the collection.
"""
junctionCondition: FooBarsByJunctionJFooIdAndJBarIdManyToManyCondition

"""Only read the last \`n\` values of the set."""
last: Int

Expand Down Expand Up @@ -212,6 +233,17 @@ type Foo implements Node {
nodeId: ID!
}

"""
A condition to be used against \`Bar\` object types. All fields are tested for equality and combined with a logical ‘and.’
"""
input FooBarsByJunctionJFooIdAndJBarIdManyToManyCondition {
"""Checks for equality with the \`Junction\` object’s \`createdAt\` field."""
createdAt: Datetime

"""Checks for equality with the \`Junction\` object’s \`id\` field."""
id: Int
}

"""A connection to a list of \`Bar\` values, with data from \`Junction\`."""
type FooBarsByJunctionJFooIdAndJBarIdManyToManyConnection {
"""
Expand Down
32 changes: 32 additions & 0 deletions __tests__/integration/schema/__snapshots__/g.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ type Post implements Node {
"""Only read the first \`n\` values of the set."""
first: Int

"""
A condition to be used in determining which values should be returned by the collection.
"""
junctionCondition: PostAuthorsManyToManyCondition

"""Only read the last \`n\` values of the set."""
last: Int

Expand Down Expand Up @@ -135,6 +140,17 @@ type PostAuthorsEdge {
node: PostAuthor
}

"""
A condition to be used against \`User\` object types. All fields are tested for equality and combined with a logical ‘and.’
"""
input PostAuthorsManyToManyCondition {
"""Checks for equality with the \`PostAuthor\` object’s \`createdAt\` field."""
createdAt: Datetime

"""Checks for equality with the \`PostAuthor\` object’s \`id\` field."""
id: UUID
}

"""A connection to a list of \`User\` values, with data from \`PostAuthor\`."""
type PostAuthorsManyToManyConnection {
"""
Expand Down Expand Up @@ -417,6 +433,11 @@ type User implements Node {
"""Only read the first \`n\` values of the set."""
first: Int

"""
A condition to be used in determining which values should be returned by the collection.
"""
junctionCondition: UserPostsByPostAuthorUserIdAndPostIdManyToManyCondition

"""Only read the last \`n\` values of the set."""
last: Int

Expand All @@ -439,6 +460,17 @@ input UserCondition {
id: UUID
}

"""
A condition to be used against \`Post\` object types. All fields are tested for equality and combined with a logical ‘and.’
"""
input UserPostsByPostAuthorUserIdAndPostIdManyToManyCondition {
"""Checks for equality with the \`PostAuthor\` object’s \`createdAt\` field."""
createdAt: Datetime

"""Checks for equality with the \`PostAuthor\` object’s \`id\` field."""
id: UUID
}

"""A connection to a list of \`Post\` values, with data from \`PostAuthor\`."""
type UserPostsByPostAuthorUserIdAndPostIdManyToManyConnection {
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,11 @@ type Person implements Node {
"""Only read the first \`n\` values of the set."""
first: Int

"""
A condition to be used in determining which values should be returned by the collection.
"""
junctionCondition: PersonTeamsByMembershipPersonIdAndTeamIdManyToManyCondition

"""Only read the last \`n\` values of the set."""
last: Int

Expand All @@ -705,6 +710,14 @@ input PersonCondition {
personName: String
}

"""
A condition to be used against \`Team\` object types. All fields are tested for equality and combined with a logical ‘and.’
"""
input PersonTeamsByMembershipPersonIdAndTeamIdManyToManyCondition {
"""Checks for equality with the \`Membership\` object’s \`createdAt\` field."""
createdAt: Datetime
}

"""A connection to a list of \`Team\` values, with data from \`Membership\`."""
type PersonTeamsByMembershipPersonIdAndTeamIdManyToManyConnection {
"""
Expand Down Expand Up @@ -1169,6 +1182,11 @@ type Team implements Node {
"""Only read the first \`n\` values of the set."""
first: Int

"""
A condition to be used in determining which values should be returned by the collection.
"""
junctionCondition: TeamMembersManyToManyCondition

"""Only read the last \`n\` values of the set."""
last: Int

Expand Down Expand Up @@ -1246,6 +1264,14 @@ input TeamCondition {
teamName: String
}

"""
A condition to be used against \`Person\` object types. All fields are tested for equality and combined with a logical ‘and.’
"""
input TeamMembersManyToManyCondition {
"""Checks for equality with the \`Membership\` object’s \`createdAt\` field."""
createdAt: Datetime
}

"""
A connection to a list of \`Person\` values, with data from \`Membership\`.
"""
Expand Down
26 changes: 26 additions & 0 deletions __tests__/integration/schema/__snapshots__/p.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,11 @@ type Person implements Node {
"""Only read the first \`n\` values of the set."""
first: Int

"""
A condition to be used in determining which values should be returned by the collection.
"""
junctionCondition: PersonTeamsByMembershipPersonIdAndTeamIdManyToManyCondition

"""Only read the last \`n\` values of the set."""
last: Int

Expand All @@ -603,6 +608,14 @@ input PersonCondition {
personName: String
}

"""
A condition to be used against \`Team\` object types. All fields are tested for equality and combined with a logical ‘and.’
"""
input PersonTeamsByMembershipPersonIdAndTeamIdManyToManyCondition {
"""Checks for equality with the \`Membership\` object’s \`createdAt\` field."""
createdAt: Datetime
}

"""A connection to a list of \`Team\` values, with data from \`Membership\`."""
type PersonTeamsByMembershipPersonIdAndTeamIdManyToManyConnection {
"""
Expand Down Expand Up @@ -965,6 +978,11 @@ type Team implements Node {
"""Only read the first \`n\` values of the set."""
first: Int

"""
A condition to be used in determining which values should be returned by the collection.
"""
junctionCondition: TeamMembersManyToManyCondition

"""Only read the last \`n\` values of the set."""
last: Int

Expand Down Expand Up @@ -1025,6 +1043,14 @@ input TeamCondition {
teamName: String
}

"""
A condition to be used against \`Person\` object types. All fields are tested for equality and combined with a logical ‘and.’
"""
input TeamMembersManyToManyCondition {
"""Checks for equality with the \`Membership\` object’s \`createdAt\` field."""
createdAt: Datetime
}

"""
A connection to a list of \`Person\` values, with data from \`Membership\`.
"""
Expand Down
Loading