Skip to content

Commit

Permalink
fix name option for prisma node
Browse files Browse the repository at this point in the history
  • Loading branch information
hayes committed Feb 23, 2023
1 parent 9c17ca4 commit 592ffd3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/tricky-suns-bake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@pothos/plugin-prisma': patch
---

Fix name option for prismaNode
1 change: 1 addition & 0 deletions packages/plugin-prisma/src/schema-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ schemaBuilderProto.prismaNode = function prismaNode(

const extendedOptions = {
...options,
name,
variant,
interfaces: [interfaceRef],
findUnique,
Expand Down
14 changes: 7 additions & 7 deletions packages/plugin-prisma/tests/__snapshots__/index.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@ type FindUniqueRelations {
withUniqueNode: WithUniqueNode!
}
type Follow {
from: User!
to: User!
}
type Media {
url: String!
}
Expand Down Expand Up @@ -300,7 +295,7 @@ type SelectUserFollowingConnection {
type SelectUserFollowingConnectionEdge {
cursor: String!
node: Follow!
node: UserFollow!
}
type SelectUserPostsConnection {
Expand Down Expand Up @@ -362,14 +357,19 @@ type UserCommentsConnectionEdge {
union UserDirectProfileWithErrorsResult = BaseError | Profile
type UserFollow {
from: User!
to: User!
}
type UserFollowingConnection {
edges: [UserFollowingConnectionEdge]!
pageInfo: PageInfo!
}
type UserFollowingConnectionEdge {
cursor: String!
node: Follow!
node: UserFollow!
}
union UserOrProfile = Profile | User
Expand Down
1 change: 1 addition & 0 deletions packages/plugin-prisma/tests/example/schema/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ const ViewerNode = builder.prismaNode('User', {
});

builder.prismaObject('Follow', {
name: 'UserFollow',
fields: (t) => ({
to: t.relation('to'),
from: t.relation('from'),
Expand Down

0 comments on commit 592ffd3

Please sign in to comment.