graphql#GraphQLString JavaScript Examples

The following examples show how to use graphql#GraphQLString. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: types.js    From crate with MIT License 6 votes vote down vote up
ProductTypesType = new GraphQLObjectType({
  name: 'productTypesType',
  description: 'User Types Type',

  fields: () => ({
    id: { type: GraphQLInt },
    name: { type: GraphQLString }
  })
})
Example #2
Source File: App.js    From Lambda with MIT License 6 votes vote down vote up
schema = new GraphQLSchema({
  query: new GraphQLObjectType({
    name: 'RootQueryType',
    fields: {
      hello: {
        type: GraphQLString,
        resolve() {
          return 'world';
        },
      },
    },
  }),
})
Example #3
Source File: types.js    From crate with MIT License 6 votes vote down vote up
UserGenderType = new GraphQLObjectType({
  name: "userGender",
  description: "User Gender Type",

  fields: () => ({
    id: { type: GraphQLInt },
    name: { type: GraphQLString },
  }),
})
Example #4
Source File: types.js    From crate with MIT License 6 votes vote down vote up
UserLoginType = new GraphQLObjectType({
  name: "userAuth",
  description: "User Authentication Type",

  fields: () => ({
    user: { type: UserType },
    token: { type: GraphQLString },
  }),
})
Example #5
Source File: types.js    From crate with MIT License 6 votes vote down vote up
UserType = new GraphQLObjectType({
  name: "user",
  description: "User type",

  fields: () => ({
    id: { type: GraphQLInt },
    name: { type: GraphQLString },
    email: { type: GraphQLString },
    address: { type: GraphQLString },
    password: { type: GraphQLString },
    role: { type: GraphQLString },
    createdAt: { type: GraphQLString },
    updatedAt: { type: GraphQLString },
  }),
})
Example #6
Source File: query.js    From crate with MIT License 6 votes vote down vote up
userLogin = {
  type: UserLoginType,
  args: {
    email: {
      name: 'email',
      type: GraphQLString
    },

    password: {
      name: 'password',
      type: GraphQLString
    },

    role: {
      name: 'role',
      type: GraphQLString
    }
  },
  resolve: login
}
Example #7
Source File: mutations.js    From crate with MIT License 6 votes vote down vote up
userUpdate = {
  type: UserType,
  args: {
    id: {
      name: "id",
      type: GraphQLInt,
    },
    name: {
      name: "name",
      type: GraphQLString,
    },
    address: {
      name: "address",
      type: GraphQLString,
    },
  },
  resolve: update,
}
Example #8
Source File: mutations.js    From crate with MIT License 6 votes vote down vote up
userSignup = {
  type: UserType,
  args: {
    name: {
      name: "name",
      type: GraphQLString,
    },

    email: {
      name: "email",
      type: GraphQLString,
    },

    password: {
      name: "password",
      type: GraphQLString,
    },
  },
  resolve: create,
}
Example #9
Source File: types.js    From crate with MIT License 6 votes vote down vote up
SubscriptionType = new GraphQLObjectType({
  name: 'subscription',
  description: 'Subscription Type',

  fields: () => ({
    id: { type: GraphQLInt },
    user: { type: UserType },
    crate: { type: CrateType },
    createdAt: { type: GraphQLString },
    updatedAt: { type: GraphQLString }
  })
})
Example #10
Source File: types.js    From crate with MIT License 6 votes vote down vote up
ProductType = new GraphQLObjectType({
  name: 'product',
  description: 'Product Type',

  fields: () => ({
    id: { type: GraphQLInt },
    name: { type: GraphQLString },
    slug: { type: GraphQLString },
    type: { type: GraphQLInt },
    gender: { type: GraphQLInt },
    description: { type: GraphQLString },
    image: { type: GraphQLString },
    createdAt: { type: GraphQLString },
    updatedAt: { type: GraphQLString }
  })
})
Example #11
Source File: mutations.js    From crate with MIT License 6 votes vote down vote up
productCreate = {
  type: ProductType,
  args: {
    name: {
      name: 'name',
      type: GraphQLString
    },

    slug: {
      name: 'slug',
      type: GraphQLString
    },

    description: {
      name: 'description',
      type: GraphQLString
    },

    type: {
      name: 'type',
      type: GraphQLInt
    },

    gender: {
      name: 'gender',
      type: GraphQLInt
    },

    image: {
      name: 'image',
      type: GraphQLString
    }
  },
  resolve: create
}
Example #12
Source File: types.js    From crate with MIT License 6 votes vote down vote up
CrateType = new GraphQLObjectType({
  name: 'crate',
  description: 'Crate Type',

  fields: () => ({
    id: { type: GraphQLInt },
    name: { type: GraphQLString },
    description: { type: GraphQLString },
    createdAt: { type: GraphQLString },
    updatedAt: { type: GraphQLString }
  })
})
Example #13
Source File: mutations.js    From crate with MIT License 6 votes vote down vote up
crateUpdate = {
  type: CrateType,
  args: {
    id: {
      name: 'id',
      type: GraphQLInt
    },

    name: {
      name: 'name',
      type: GraphQLString
    },

    description: {
      name: 'description',
      type: GraphQLString
    }
  },
  resolve: update
}
Example #14
Source File: mutations.js    From crate with MIT License 6 votes vote down vote up
crateCreate = {
  type: CrateType,
  args: {
    name: {
      name: 'name',
      type: GraphQLString
    },

    description: {
      name: 'description',
      type: GraphQLString
    }
  },
  resolve: create
}
Example #15
Source File: 107-test.js    From cybsec with GNU Affero General Public License v3.0 5 votes vote down vote up
remoteSchema = new GraphQLSchema({
  query: new GraphQLObjectType({
    name: 'Query',
    fields: {
      users: {
        type: new GraphQLList(new GraphQLObjectType({
          name: 'User',
          fields: {
            name: {
              type: GraphQLString
            },
            age: {
              type: GraphQLInt
            },
            access: {
              type: new GraphQLObjectType({
                name: 'Access',
                fields: {
                  msg: {
                    type: GraphQLString
                  }
                }
              }),
              resolve: source => ({
                msg: source.age >= 20 ? `allowed` : 'disallowed'
              })
            }
          }
        })),
        resolve: () => [{
          name: 'u1',
          age: 10
        }, {
          name: 'u2',
          age: 20
        }, {
          name: 'u3',
          age: 30
        }]
      }
    }
  })
})
Example #16
Source File: query.js    From crate with MIT License 5 votes vote down vote up
product = {
  type: ProductType,
  args: {
    slug: { type: GraphQLString }
  },
  resolve: getBySlug
}
Example #17
Source File: mutations.js    From crate with MIT License 5 votes vote down vote up
productUpdate = {
  type: ProductType,
  args: {
    id: {
      name: 'id',
      type: GraphQLInt
    },

    name: {
      name: 'name',
      type: GraphQLString
    },

    slug: {
      name: 'slug',
      type: GraphQLString
    },

    description: {
      name: 'description',
      type: GraphQLString
    },

    type: {
      name: 'type',
      type: GraphQLInt
    },

    gender: {
      name: 'gender',
      type: GraphQLInt
    },

    image: {
      name: 'image',
      type: GraphQLString
    }
  },
  resolve: update
}
Example #18
Source File: query.js    From crate with MIT License 5 votes vote down vote up
crates = {
  type: new GraphQLList(CrateType),
  args: {
    orderBy: { type: GraphQLString }
  },
  resolve: getAll
}