26 lines
423 B
JavaScript
26 lines
423 B
JavaScript
|
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]);
|
||
|
}
|
||
|
};
|