Skip to content

Instantly share code, notes, and snippets.

@uriee
Last active May 29, 2016 05:13
Show Gist options
  • Save uriee/986eee450b6fc2eac7fe27b86bbb5896 to your computer and use it in GitHub Desktop.
Save uriee/986eee450b6fc2eac7fe27b86bbb5896 to your computer and use it in GitHub Desktop.
trying graphql
const Member = new GraphQLObjectType({
name: 'Member',
description: 'This represent a Member',
fields: () => ({
id: {type: new GraphQLNonNull(GraphQLString)},
name: {type: GraphQLString},
pic: {type: GraphQLString}
})
})
const Comment = new GraphQLObjectType({
name: 'Comment',
description: 'This represent a Comment',
fields: () => ({
date : {type: new GraphQLNonNull(GraphQLInt)},
body: {type: GraphQLString},
member : {type: new GraphQLNonNull(GraphQLObjectType)},
support: {type: GraphQLInt}
})
})
const Pulse = new GraphQLObjectType({
name: 'Pulse',
description: 'This represent a Pulse',
fields: () => ({
id: {type: new GraphQLNonNull(GraphQLString)},
pulsedAt : {type: GraphQLInt},
status: {type: GraphQLString},
support: {type: GraphQLInt}
})
})
const Statement = new GraphQLObjectType({
name: 'Statement',
description: 'This represent a Statement',
fields: () => ({
id: {type: new GraphQLNonNull(GraphQLString)},
statement : {type: GraphQLInt},
status: {type: GraphQLString},
})
})
const Variable = new GraphQLObjectType({
name: 'Variable',
description: 'This represent a Variable',
fields: () => ({
name : {type: new GraphQLNonNull(GraphQLString)},
desc : {type: GraphQLString},
value : {type: GraphQLString},
})
})
const Support = new GraphQLObjectType({
name : support
fields: () => ({
support : GraphQLInt,
members : {
type : new GraphQLList(Member)
resolve: member => r.table(kbz).get(member)
}
})
})
const Proposal = new GraphQLObjectType({
name: 'Proposal',
description: 'This represent a Proposal',
fields: () => ({
id: {type: new GraphQLNonNull(GraphQLString)},
type: {type: new GraphQLNonNull(GraphQLString)},
status: {type: new GraphQLNonNull(GraphQLInt)},
body: {type: GraphQLString},
age : new GraphQLNonNull(GraphQLInt),
vote : {
for : GraphQLInt,
againt : GraphQLInt,
members : GraphQLList(Member)
},
support : {
support : GraphQLInt,
members : GraphQLList(Member)
},
comments : GraphQLList(Comments)
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment