АР
Size: a a a
АР
АР
АР
АР
АР
ДР
KA
RZ
KA
KA
RZ
KA
const {
GraphQLObjectType,
GraphQLNonNull,
GraphQLString,
GraphQLInt,
GraphQLID,
GraphQLList
} = require('graphql');
const {Song} = require('../../db/models');
const singerType = require('../queries/singer');
const SongType = new GraphQLObjectType({
name: 'Song',
description: 'This is Song Type',
fields: {
id: {
type: new GraphQLNonNull(GraphQLID),
},
title: {
type: new GraphQLNonNull(GraphQLString),
},
year: {
type: new GraphQLNonNull(GraphQLInt),
},
duration: {
type: new GraphQLNonNull(GraphQLInt),
},
size: {
type: new GraphQLNonNull(GraphQLInt),
},
filePath: {
type: GraphQLInt
},
bitRate: {
type: GraphQLInt
},
singers: {
type: new GraphQLList(singerType),
}
},
args: {
id: new GraphQLNonNull(GraphQLID)
},
resolve: (root, {id}) => {
const song = Song.findById(id).exec();
if(!song) {
throw new Error('Error')
}
return song
}
});
module.exports = SongType;
const {вылетает ошибка
GraphQLObjectType,
GraphQLNonNull,
GraphQLString,
GraphQLID,
GraphQLList
} = require('graphql');
const {Singer} = require('../../db/models');
const SongType = require('../queries/song');
const SingerType = new GraphQLObjectType({
name: 'Singer',
description: 'This is Singer Type',
fields: {
id: {
type: new GraphQLNonNull(GraphQLID),
},
fullName: {
type: new GraphQLNonNull(GraphQLString),
},
songs: {
type: new GraphQLList(SongType)
}
},
args: {
id: new GraphQLNonNull(GraphQLID)
},
resolve: (root, {id}) => {
const singer = Singer.findById(id).exec();
if(!singer) {
throw new Error('Error')
}
return singer
}
});
module.exports = SingerType;
Expected [object Object] to be a GraphQL type
. в чем может быть проблема?OV
KA
OV
KA
KA
OV