michal.tomsia
04/07/2018, 12:31 PMfunction createCategory(parent, { input }, ctx, info) {
const category = ctx.db.mutation.createCategory({ data: input });
return {
edge { node: category }
}
}
If I am passing info
to ctx.db.mutation.createCategory
I am getting error about subselectionAdam Pavlisin
04/07/2018, 4:12 PMtype List @model {
id: ID! @isUnique
name: String!
tasks: [Task!]! @relation(name: "ListOnTask")
}
type Task @model {
id: ID! @isUnique
list: [List!]! @relation(name: "ListOnTask")
name: String!
}
Given I can have one task in multiple lists how can I define order/position/rank of the task within each list separately?igm
04/07/2018, 8:41 PMigm
04/07/2018, 8:42 PMigm
04/07/2018, 8:51 PMigm
04/07/2018, 8:51 PMpasa
04/07/2018, 10:50 PMdigitaltopo
04/07/2018, 11:46 PMdigitaltopo
04/07/2018, 11:53 PMeloff
04/08/2018, 12:00 PMRaviv
04/08/2018, 12:45 PMYannick
04/08/2018, 4:20 PMpasa
04/08/2018, 4:43 PMtype Mutation {
createDraft(title: String!, text: String): Post
deletePost(id: ID!): Post
publish(id: ID!): Post
createSite(urlhash: String!): Site
}
and to index.js:
Mutation: {
createSite(parent, { urlhash }, ctx, info) {
return ctx.db.mutation.createSite(
{
data: {
urlhash
},
},
info,
)
},
},
But I still get the error "Unknown argument 'urlhash' on field 'createSite'", if I call the mutation like this:
mutation{
createSite(urlhash: "dqwda")
{id}
}
pasa
04/08/2018, 4:45 PMpasa
04/08/2018, 5:09 PMeloff
04/08/2018, 5:12 PMpasa
04/08/2018, 5:25 PMeloff
04/08/2018, 5:26 PMhuv1k
04/08/2018, 5:27 PMpasa
04/08/2018, 6:40 PMDevin
04/08/2018, 7:01 PMno Node for the model User with value ...
except when I query me I get back the correct tokenDevin
04/08/2018, 7:01 PMKat
04/08/2018, 8:15 PMKat
04/08/2018, 8:15 PMKat
04/08/2018, 8:16 PMKat
04/08/2018, 8:16 PMmcierpicki
04/08/2018, 8:32 PMAdvice
and connect to it, already created, tags, categories, videos and images. Yet for some reason this this setup does not work - i don't know how to set tags, categories, videos and images inputs so that it does not throw error.
type Mutation {
createAdvice(params: CreateAdviceParams!): Advice
}
type Advice {
id: ID!
name:String!
value: Int!
description: String!
tags: [AdviceTag]!
categories: [AdviceCategory]!
videos: [VideoAsset!]!
images: [ImageAsset!]!
}
input CreateAdviceParams {
name:String!
value: Int!
description: String!
tags: [AdviceTag]
categories: [AdviceCategory]
videos: [VideoAsset]
images: [ImageAsset]
}
Mutation: {
createAdvice(parent, {params}, ctx, info) {
return ctx.db.mutation.createAdvice({data: params}, info)
},
},
mutation {
createAdvice(params:{
name: "Saraasdh"
value: 1,
description: "Jakis tam description",
tags: { connect: [{
id : "cjfr8wmere6bt0a422693ql94"
}]},
categories: { connect: []},
videos: { connect: []},
images: { connect: []}
}) {
id,
name
}
}
Kat
04/08/2018, 8:55 PMpasa
04/08/2018, 9:02 PMmcierpicki
04/08/2018, 10:12 PM