joyent-portal/cloudapi-graphql/src/schema/queries/nics.js

26 lines
423 B
JavaScript
Raw Normal View History

2016-10-10 18:37:26 +03:00
const NicType = require('../types/nic');
const graphql = require('graphql');
const api = require('../../api');
const {
GraphQLList,
GraphQLString
} = graphql;
module.exports = {
type: new GraphQLList(NicType),
args: {
mac: {
type: GraphQLString
}
},
resolve(root, args) {
const {
list,
get
} = api.nics;
return !args.id ? list() : get(args).then((nic) => [nic]);
}
};