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