get rid of unnecessary list types
This commit is contained in:
@@ -2,7 +2,8 @@ import {
|
||||
GraphQLNonNull,
|
||||
GraphQLObjectType,
|
||||
GraphQLInt,
|
||||
GraphQLString
|
||||
GraphQLString,
|
||||
GraphQLList
|
||||
} from 'graphql';
|
||||
|
||||
import {
|
||||
@@ -49,16 +50,13 @@ var House = DB.sequelize.define(NAME, {
|
||||
name: NAME,
|
||||
description: 'A house',
|
||||
fields: () => {
|
||||
var {connectionType: power_data_connection} = connectionDefinitions({name: DB.PowerDatum.name, nodeType: DB.PowerDatum.graphql_type}),
|
||||
{connectionType: habitants_connection} = connectionDefinitions({name: DB.User.name, nodeType: DB.User.graphql_type});
|
||||
|
||||
return {
|
||||
id: globalIdField(NAME),
|
||||
name: {
|
||||
type: new GraphQLNonNull(GraphQLString)
|
||||
},
|
||||
power_data: {
|
||||
type: power_data_connection,
|
||||
type: new GraphQLList(DB.PowerDatum.graphql_type),
|
||||
description: "Returns house's power data.",
|
||||
args: connectionArgs,
|
||||
resolve: (house, args) => {
|
||||
@@ -66,7 +64,7 @@ var House = DB.sequelize.define(NAME, {
|
||||
}
|
||||
},
|
||||
habitants: {
|
||||
type: habitants_connection,
|
||||
type: new GraphQLList(DB.User.graphql_type),
|
||||
description: "Returns list of house's habitants.",
|
||||
args: connectionArgs,
|
||||
resolve: (house, args) => {
|
||||
|
||||
@@ -49,14 +49,13 @@ var User = DB.sequelize.define(NAME, {
|
||||
name: NAME,
|
||||
description: 'A house',
|
||||
fields: () => {
|
||||
var {connectionType: house_connection} = connectionDefinitions({name: DB.House.name, nodeType: DB.House.graphql_type});
|
||||
return {
|
||||
id: globalIdField(NAME),
|
||||
username: {
|
||||
type: new GraphQLNonNull(GraphQLString)
|
||||
},
|
||||
house: {
|
||||
type: house_connection,
|
||||
type: DB.House.graphql_type,
|
||||
description: "Returns user's house.",
|
||||
resolve: (user, args) => {
|
||||
return user.getHouse();
|
||||
|
||||
Reference in New Issue
Block a user