<commit_before>import { GraphQLObjectType,
         GraphQLString,
         GraphQLList,
         GraphQLInt,
         GraphQLBoolean,
         GraphQLSchema } from 'graphql'

import LiftType  from './LiftType'
import TrailType from './TrailType'

import fetch from 'isomorphic-fetch'

var host = (process.env.NODE_ENV === "production") ?
    "https://www.moonhighway.com" : (process.env.NODE_ENV === "staging") ?
        "http://staging-moonhighway.herokuapp.com" :
        "http://localhost:3000"

const QueryType = new GraphQLObjectType({
    name: 'Query',
    description: 'Root query for the Snowtooth Graph',
    fields: () => ({
        allLifts: {
            type: new GraphQLList(LiftType),
            description: "All ski lifts at Snowtooth",
            args: {
                status: {
                    type: GraphQLString
                }
            },
            resolve: (_, {status}) => {
                var uri = `${host}/class/api/snowtooth`
                if (status) {
                    uri += `/lifts/status/${status}`
                } else {
                    uri += `/lifts`
                }
                return fetch(uri).then(r=>r.json())
            }
        },
        allTrails: {
            type: new GraphQLList(TrailType),
            description: "All ski trails at Snowtooth",
            args: {
                difficulty: {
                    type: GraphQLString
                },
                status: {
                    type: GraphQLString
                }
            },
            resolve: (_, { difficulty, status }) => {
                var uri = `${host}/class/api/snowtooth`
                if (difficulty) {
                    uri += `/trails/difficulty/${difficulty}`
                } else if (status) {
                    uri += `/trails/status/${status}`
                } else {
                    uri += `/trails`
                }
                return fetch(uri).then(r=>r.json())
            }
        },
        lift: {
            type: LiftType,
            description: "An individual ski lift at Snowtooth",
            args: {
                name: {
                    type: GraphQLString
                }
            },
            resolve: (_, { name }) => {
                var uri = `${host}/class/api/snowtooth`
                if (name) {
                    uri += `/lifts/${name}`
                }
                return fetch(uri).then(r=>r.json()).then(lifts => lifts[0])
            }
        }
    })
})

export default new GraphQLSchema({
    query: QueryType
})<commit_msg>Adds trail query<commit_after>import { GraphQLObjectType,
         GraphQLString,
         GraphQLList,
         GraphQLInt,
         GraphQLBoolean,
         GraphQLSchema } from 'graphql'

import LiftType  from './LiftType'
import TrailType from './TrailType'

import fetch from 'isomorphic-fetch'

var host = (process.env.NODE_ENV === "production") ?
    "https://www.moonhighway.com" : (process.env.NODE_ENV === "staging") ?
        "http://staging-moonhighway.herokuapp.com" :
        "http://localhost:3000"

const QueryType = new GraphQLObjectType({
    name: 'Query',
    description: 'Root query for the Snowtooth Graph',
    fields: () => ({
        allLifts: {
            type: new GraphQLList(LiftType),
            description: "All ski lifts at Snowtooth",
            args: {
                status: {
                    type: GraphQLString
                }
            },
            resolve: (_, {status}) => {
                var uri = `${host}/class/api/snowtooth`
                if (status) {
                    uri += `/lifts/status/${status}`
                } else {
                    uri += `/lifts`
                }
                return fetch(uri).then(r=>r.json())
            }
        },
        allTrails: {
            type: new GraphQLList(TrailType),
            description: "All ski trails at Snowtooth",
            args: {
                difficulty: {
                    type: GraphQLString
                },
                status: {
                    type: GraphQLString
                }
            },
            resolve: (_, { difficulty, status }) => {
                var uri = `${host}/class/api/snowtooth`
                if (difficulty) {
                    uri += `/trails/difficulty/${difficulty}`
                } else if (status) {
                    uri += `/trails/status/${status}`
                } else {
                    uri += `/trails`
                }
                return fetch(uri).then(r=>r.json())
            }
        },
        lift: {
            type: LiftType,
            description: "An individual ski lift at Snowtooth",
            args: {
                name: {
                    type: GraphQLString
                }
            },
            resolve: (_, { name }) => {
                var uri = `${host}/class/api/snowtooth`
                if (name) {
                    uri += `/lifts/${name}`
                }
                return fetch(uri).then(r=>r.json()).then(lifts => lifts[0])
            }
        },
        trail: {
            type: TrailType,
            description: "An individual ski trail at Snowtooth",
            args: {
                name: {
                    type: GraphQLString
                }
            },
            resolve: (_, { name }) => {
                var uri = `${host}/class/api/snowtooth`
                if (name) {
                    uri += `/trails/${name}`
                }
                return fetch(uri).then(r=>r.json()).then(trails => trails[0])
            }
        }
    })
})

export default new GraphQLSchema({
    query: QueryType
})
{'fraction_non_alphanumeric': 0.1241004037212568, 'fraction_numerical': 0.0019308407934000352, 'mean_word_length': 1.1501886792452831, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 22, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4094828', 'n_tokens_mistral': 1576, 'n_tokens_neox': 1519, 'n_words': 310}