mirror of https://github.com/yldio/copilot.git
21 lines
468 B
JavaScript
21 lines
468 B
JavaScript
const PolicyType = require('../types/policy');
|
|
const graphql = require('graphql');
|
|
const api = require('../../api');
|
|
|
|
const { GraphQLList, GraphQLID } = graphql;
|
|
|
|
module.exports = {
|
|
type: new GraphQLList(PolicyType),
|
|
args: {
|
|
id: {
|
|
type: GraphQLID,
|
|
description: '`id` of the `PolicyType` to filter'
|
|
}
|
|
},
|
|
resolve(root, args) {
|
|
const { list, get } = api.policies;
|
|
|
|
return !args.id ? list() : get(args).then(policy => [policy]);
|
|
}
|
|
};
|