Skip to content
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
package-lock.json

# Runtime data
pids
Expand Down Expand Up @@ -60,3 +61,6 @@ typings/
# next.js build output
.next
/dist

# editor config
.vscode
20 changes: 20 additions & 0 deletions src/__tests__/__snapshots__/schema-base.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,9 @@ input ItemCondition {

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

\\"\\"\\"The globally unique \`ID\` to be used in selecting a single \`Person\`.\\"\\"\\"
personByPersonOrganizationIdAndPersonIdentifier: [ID!]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still not comfortable with this naming for an array field, I'd prefer something like personByPersonOrganizationIdAndPersonIdentifierIsOneOf or In or IsIn or ContainedIn.

Incidentally the description doesn't match (missing plural).

}

\\"\\"\\"An input for mutations affecting \`Item\`\\"\\"\\"
Expand All @@ -316,6 +319,8 @@ input ItemInput {
personIdentifier: String
label: String!
createdAt: Datetime

\\"\\"\\"The globally unique \`ID\` to be used in specifying a single \`Person\`.\\"\\"\\"
personByPersonOrganizationIdAndPersonIdentifier: ID
}

Expand All @@ -326,6 +331,8 @@ input ItemPatch {
personIdentifier: String
label: String
createdAt: Datetime

\\"\\"\\"The globally unique \`ID\` to be used in specifying a single \`Person\`.\\"\\"\\"
personByPersonOrganizationIdAndPersonIdentifier: ID
}

Expand Down Expand Up @@ -730,6 +737,11 @@ input PersonCondition {

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

\\"\\"\\"
The globally unique \`ID\` to be used in selecting a single \`Organization\`.
\\"\\"\\"
organizationByOrganizationId: [ID!]
}

\\"\\"\\"An input for mutations affecting \`Person\`\\"\\"\\"
Expand All @@ -738,6 +750,10 @@ input PersonInput {
identifier: String!
name: String!
createdAt: Datetime

\\"\\"\\"
The globally unique \`ID\` to be used in specifying a single \`Organization\`.
\\"\\"\\"
organizationByOrganizationId: ID
}

Expand All @@ -749,6 +765,10 @@ input PersonPatch {
identifier: String
name: String
createdAt: Datetime

\\"\\"\\"
The globally unique \`ID\` to be used in specifying a single \`Organization\`.
\\"\\"\\"
organizationByOrganizationId: ID
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,9 @@ input ItemCondition {

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

\\"\\"\\"The globally unique \`ID\` to be used in selecting a single \`Person\`.\\"\\"\\"
personByPersonOrganizationIdAndPersonIdentifier: [ID!]
}

\\"\\"\\"An input for mutations affecting \`Item\`\\"\\"\\"
Expand All @@ -316,6 +319,8 @@ input ItemInput {
personIdentifier: String
label: String!
createdAt: Datetime

\\"\\"\\"The globally unique \`ID\` to be used in specifying a single \`Person\`.\\"\\"\\"
personByPersonOrganizationIdAndPersonIdentifier: ID
}

Expand All @@ -326,6 +331,8 @@ input ItemPatch {
personIdentifier: String
label: String
createdAt: Datetime

\\"\\"\\"The globally unique \`ID\` to be used in specifying a single \`Person\`.\\"\\"\\"
personByPersonOrganizationIdAndPersonIdentifier: ID
}

Expand Down Expand Up @@ -730,6 +737,11 @@ input PersonCondition {

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

\\"\\"\\"
The globally unique \`ID\` to be used in selecting a single \`Organization\`.
\\"\\"\\"
organizationByOrganizationId: [ID!]
}

\\"\\"\\"An input for mutations affecting \`Person\`\\"\\"\\"
Expand All @@ -738,6 +750,10 @@ input PersonInput {
identifier: String!
name: String!
createdAt: Datetime

\\"\\"\\"
The globally unique \`ID\` to be used in specifying a single \`Organization\`.
\\"\\"\\"
organizationByOrganizationId: ID
}

Expand All @@ -749,6 +765,10 @@ input PersonPatch {
identifier: String
name: String
createdAt: Datetime

\\"\\"\\"
The globally unique \`ID\` to be used in specifying a single \`Organization\`.
\\"\\"\\"
organizationByOrganizationId: ID
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,9 @@ input ItemCondition {

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

\\"\\"\\"The globally unique \`ID\` to be used in selecting a single \`Person\`.\\"\\"\\"
personByPersonOrganizationIdAndPersonIdentifier: [ID!]
}

\\"\\"\\"An input for mutations affecting \`Item\`\\"\\"\\"
Expand All @@ -316,6 +319,8 @@ input ItemInput {
personIdentifier: String
label: String!
createdAt: Datetime

\\"\\"\\"The globally unique \`ID\` to be used in specifying a single \`Person\`.\\"\\"\\"
personByPersonOrganizationIdAndPersonIdentifier: ID
}

Expand All @@ -326,6 +331,8 @@ input ItemPatch {
personIdentifier: String
label: String
createdAt: Datetime

\\"\\"\\"The globally unique \`ID\` to be used in specifying a single \`Person\`.\\"\\"\\"
personByPersonOrganizationIdAndPersonIdentifier: ID
}

Expand Down Expand Up @@ -730,6 +737,11 @@ input PersonCondition {

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

\\"\\"\\"
The globally unique \`ID\` to be used in selecting a single \`Organization\`.
\\"\\"\\"
organizationByOrganizationId: [ID!]
}

\\"\\"\\"An input for mutations affecting \`Person\`\\"\\"\\"
Expand All @@ -738,6 +750,10 @@ input PersonInput {
identifier: String!
name: String!
createdAt: Datetime

\\"\\"\\"
The globally unique \`ID\` to be used in specifying a single \`Organization\`.
\\"\\"\\"
organizationByOrganizationId: ID
}

Expand All @@ -749,6 +765,10 @@ input PersonPatch {
identifier: String
name: String
createdAt: Datetime

\\"\\"\\"
The globally unique \`ID\` to be used in specifying a single \`Organization\`.
\\"\\"\\"
organizationByOrganizationId: ID
}

Expand Down
50 changes: 49 additions & 1 deletion src/__tests__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ Object {
expect(updateResult.errors).toBeFalsy();
expect(updateResult.data).toBeTruthy();
const {
updateItem: { item: updatedItem },
updateItem: { item: updatedItem }
} = updateResult.data!;
expect(updatedItem).toMatchInlineSnapshot(`
Object {
Expand All @@ -246,6 +246,54 @@ Object {
"personIdentifier": "3",
"personOrganizationId": 2,
}
`);

const queryResult = await graphql(
schema,
`
query {
allItems(condition: {
personByPersonOrganizationIdAndPersonIdentifier: [
"WyJwZW9wbGUiLDIsIjMiXQ=="
"WyJwZW9wbGUiLDIsIjIiXQ=="
]
}) {
nodes {
personByPersonOrganizationIdAndPersonIdentifier {
nodeId
organizationId
identifier
}
personOrganizationId
personIdentifier
label
}
}
}
`,
null,
context,
{},
null
);
expect(queryResult.errors).toBeFalsy();
expect(queryResult.data).toBeTruthy();
const {
allItems: { nodes }
} = queryResult.data!;
expect(nodes).toMatchInlineSnapshot(`
Array [
Object {
"label": "Gadget",
"personByPersonOrganizationIdAndPersonIdentifier": Object {
"identifier": "3",
"nodeId": "WyJwZW9wbGUiLDIsIjMiXQ==",
"organizationId": 2,
},
"personIdentifier": "3",
"personOrganizationId": 2,
},
]
`);

const unsetResult = await graphql(
Expand Down
Loading