joan
02/15/2019, 4:19 PMdates
field? I get this error message:
[GraphQL error]: Message: Variable '$data' expected value of type 'EventUpdateInput!' but got: {"title":"title here","slug":"title-here","description":"lorem ipsum.","dates":["2019-02-28T11:11"]}. Reason: 'dates' Expected 'EventUpdatedatesInput', found not an object. (line 1, column 43):
mutation ($where: EventWhereUniqueInput!, $data: EventUpdateInput!) {
^, Location: [object Object], Path: updateEvent
I get that error when trying to run a mutation to update an event:
const UPDATE_EVENT_MUTATION = gql`
mutation UpdateEventMutation($id: ID!, $title: String!, $slug: String!, $description: String, $dates: [String]) {
updateEvent(id: $id, title: $title, slug: $slug, description: $description, dates: $dates) {
id
title
description
dates
}
}
`;
graphql.schema:
type Mutation {
updateEvent(id: ID!, title: String!, slug: String!, description: String, dates: [String]): Event
}
type Event {
id: ID!
slug: String!
title: String!
description: String
dates: [String]
places: [Place]
menus: [String]
}
auto generated prisma.schema:
input EventUpdatedatesInput {
set: [String!]
}
updateEvent(data: EventUpdateInput!, where: EventWhereUniqueInput!): Event
Harshit
02/15/2019, 4:21 PMjoan
02/15/2019, 4:22 PMupdateEvent(parent, { id, title, slug, description, dates }, context) {
return context.prisma.updateEvent({
where: { id },
data: { title, slug, description, dates },
});
},
Harshit
02/15/2019, 4:32 PMHarshit
02/15/2019, 4:32 PMHarshit
02/15/2019, 4:32 PMupdateEvent(parent, { id, title, slug, description, dates }, context) {
return context.prisma.updateEvent({
where: { id },
data: { title, slug, description, dates: { set: dates } },
});
},
joan
02/15/2019, 4:37 PMset
for arrays