Skip to content

Instantly share code, notes, and snippets.

@frikille
Last active August 29, 2015 14:25
Show Gist options
  • Save frikille/a34bcb27d43e9f4cce7c to your computer and use it in GitHub Desktop.
Save frikille/a34bcb27d43e9f4cce7c to your computer and use it in GitHub Desktop.
Generated GraphQL schema
import {
graphql,
GraphQLInt,
GraphQLString,
GraphQLFloat,
GraphQLBoolean,
GraphQLList,
GraphQLObjectType,
GraphQLSchema
} from 'graphql';
import PostBlockType from './PostBlockType.js';
import PostLikeType from './PostLikeType.js';
import PostCommentType from './PostCommentType.js';
import JournalType from './JournalType.js';
import UserType from './UserType.js';
let PostType = new GraphQLObjectType({
name: 'Post',
description: 'A Post object',
fields: () => ({
id: {
type: GraphQLInt,
description: 'The id of a post'
},
title: {
type: GraphQLString,
description: 'The title of a post'
},
slug: {
type: GraphQLString,
description: 'The slug of a post'
},
publish_date: {
type: GraphQLString,
description: 'The publish_date of a post'
},
location: {
type: GraphQLString,
description: 'The location of a post'
},
user_id: {
type: GraphQLInt,
description: 'The user_id of a post'
},
journal_id: {
type: GraphQLInt,
description: 'The journal_id of a post'
},
post_state_id: {
type: GraphQLInt,
description: 'The post_state_id of a post'
},
gps_location: {
type: GraphQLString,
description: 'The gps_location of a post'
},
tags: {
type: GraphQLString,
description: 'The tags of a post'
},
blocks: {
type: new GraphQLList(PostBlockType),
description: 'The list of blocks of a post',
resolve: (post) => {}
},
likes: {
type: new GraphQLList(PostLikeType),
description: 'The list of likes of a post',
resolve: (post) => {}
},
comments: {
type: new GraphQLList(PostCommentType),
description: 'The list of comments of a post',
resolve: (post) => {}
},
journal: {
type: JournalType,
description: 'The journal of a post',
resolve: (post) => {}
},
author: {
type: UserType,
description: 'The author of a post',
resolve: (post) => {}
}
})
});
let QueryType = new GraphQLObjectType({
name: 'Query',
fields: () => ({
post: {
type: PostType,
resolve: () => {}
}
})
});
let Schema = new GraphQLSchema({
query: QueryType
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment