JSONField
JSONField
example. I would like to filter, search
on it. Is that possible?
Can anyone point me to a reference implementation of nested / namespaced Mutations?
mutation {
Diagnostics {
doSomeAction(input:3){
success
message
}
}
}
Presently have single level working just fine (i.e. no Diagnostics
in the object above). I can define the schema just fine however run into problems with the sub-mutation actually being resolved.
const express = require("express");
const { gql, ApolloServer } = require("apollo-server-express");
const heroes = [
{ id: 1000, name: "bunny" },
{ id: 2000, name: "ram" }
];
const typeDefs = gql`
type Query {
heroes: [Hero]
getHero(id: Int): Hero
}
type Hero {
id: Int
name: String
}
`;
const resolvers = {
Query: {
heroes: () => heroes,
getHero: (_, args, context) => heroes.find(e => e === args.id)
}
};
const server = new ApolloServer({ typeDefs, resolvers });
const app = express();
server.applyMiddleware({ app });
app.listen({ port: 4000 }, () =>
console.log("http://localhost:4000" + server.graphqlPath)
);
getHero: (_, args, context) => heroes.find(e => e === args.id)
{
getHero(id:1000){
id
name
}
}
export const resolvers = {
User: {
hasLocations(obj, args, context, info) {
// -- count the locations and set to false / true
return true;
}
}
};
hasLocation
field?