Currently I am doing something like this ``` funct...
# prisma-whats-new
m
Currently I am doing something like this
Copy code
function 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 subselection
n
add
info
to the category resolver
m
thanks for the reply, can you give me a hint of how can this be achieved? Do you mean creating resolver for
edge: { node }
for
Category
type?
n
replace
const category = ctx.db.mutation.createCategory({ data: input });
with
const category = ctx.db.mutation.createCategory({ data: input }, info);
m
this gives me an error about subselection, because
Category
doesn't have an
edge
field
n
ah, right. you'd need to "transform" the info object accordingly
m
is there a way to convert
info
back to AST graphql format?
n
you could use a recently added method "makeSubInfo" for this: https://github.com/graphql-binding/graphql-binding/pull/79 However this new API is influx at the moment, here's a relevant discussion: https://github.com/graphql-binding/graphql-binding/issues/80
m
I will give it a try, thanks
👌 1
n
very curious to hear your thoughts 🙂
m
I will definitely share them 🙂
🙌 1