27 lines
490 B
JavaScript
27 lines
490 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]);
|
|
}
|
|
};
|