joshhopkins
01/22/2019, 7:31 PM$subscribe
?Ash Berlin-Taylor
02/01/2019, 3:26 PMawait prisma.createUser(mutation)
and prisma.createUser(mutation).id()
-- or what that was doing, and why the examples (in the codesandbox) all return plain objectsPlínio Naves
02/06/2019, 1:06 AMJuliano Sena
02/11/2019, 5:44 PMJuliano Sena
02/11/2019, 5:44 PMJuliano Sena
02/11/2019, 5:45 PMamandeep
02/16/2019, 3:06 PMamandeep
02/16/2019, 3:07 PMjackgray
02/22/2019, 3:59 PMGraphQLError: Syntax Error: Cannot parse the unexpected character ".".
It goes away when I remove this line from my schema: # import * from './generated/prisma-client
Used this method for almost a year without issues until recently. Using prisma-client-lib v 1.25.7
Min repo: github.com/jackgray/govtrackrUxname
03/13/2019, 1:19 PMsender
(type User) from created message.
newMessage.sender
is undefined
dany
03/15/2019, 5:43 AMdany
03/15/2019, 5:44 AMdany
03/15/2019, 5:44 AMdany
03/15/2019, 5:44 AMdany
03/15/2019, 5:44 AMdany
03/15/2019, 5:45 AMPeter Mbanugo
03/15/2019, 12:19 PMPeter Mbanugo
03/15/2019, 12:21 PMtype Query {
info: String!
users: [User!]!
conversations: [Conversation!]!
conversation(id: String!): Conversation!
}
type Mutation {
createUser(name: String!): User!
createConversation(user1: ID!, user2: ID!): Conversation!
}
type User {
id: ID!
name: String!
conversations: [Conversation!]!
}
type Conversation {
id: ID!
messages: [Message!]!
users: [User!]!
}
type Message {
id: ID!
content: String!
createdAt: String!
userId: ID!
conversation: Conversation!
}
And I have my resolvers implemented as such:
const resolvers = {
Query: {
info: (root, args, context) =>
`This is the API of chatt app for Packt course`,
users: (root, args, context) => context.prisma.users(),
conversations: (root, args, context) => context.prisma.conversations(),
conversation: (root, args, context) =>
context.prisma.conversations({ id: args.id })
},
Mutation: {
createUser: (root, args, context) => {
return context.prisma.createUser({
name: args.name
});
},
createConversation: (root, args, context) => {
return context.prisma.createConversation({
users: {
connect: [{ id: args.user1 }, { id: args.user2 }]
}
});
}
},
Conversation: {
users: (parent, args, context) => {
console.log("calling users");
return context.prisma.conversations({ id: parent.id }).users();
},
id: (parent, args, context) => parent.id
},
User: {
conversations: (parent, args, context) => {
return context.prisma.users({ id: parent.id }).conversations();
}
}
};
When I call the query
query {
conversation (id: "cjta0oy64ocr60b79pevff0lw"){
id,
users {
name
}
}
}
I get an error that says
{
"data": null,
"errors": [
{
"message": "Could not find argument id for type Conversation",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"conversation"
]
}
]
}
I don’t know what that meansPeter Mbanugo
03/15/2019, 12:23 PMPeter Mbanugo
03/15/2019, 12:30 PMPeter Mbanugo
03/15/2019, 1:37 PMcontext.prisma.conversations({ id: parent.id }).users();
I should be using context.prisma.conversations()
yuri
03/18/2019, 3:53 PMtype Member {
id: ID! @unique
currentBalance: Float!
transactions: [Transaction!]
retailers: [Retailer!]
}
type Retailer {
id: ID! @unique
name: String!
}
type Transaction {
id: ID! @unique
purchaseDate: DateTime!
rewardedDate: DateTime!
}
typescript-client generates interface without relational fields.
export interface Member {
id: ID_Output;
currentBalance: Float;
}
So some of my resolvers don't have necessary types 😞 Anyone already faced this?
Thanks in advance!Gabe Tong
03/19/2019, 3:05 AMBiel Simon
03/21/2019, 4:55 AMfriebetill
04/15/2019, 11:52 AMfriebetill
04/15/2019, 12:23 PMfriebetill
04/15/2019, 12:24 PMprilutskiy
04/18/2019, 7:28 PMprilutskiy
04/18/2019, 7:28 PMChinmay Ajit Acharya
04/22/2019, 1:50 PM