2016-10-10 18:37:26 +03:00
|
|
|
const ServiceType = require('../types/service');
|
|
|
|
const graphql = require('graphql');
|
|
|
|
const api = require('../../api');
|
|
|
|
|
2017-04-27 21:26:15 +03:00
|
|
|
const { GraphQLList } = graphql;
|
2016-10-10 18:37:26 +03:00
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
type: new GraphQLList(ServiceType),
|
|
|
|
resolve() {
|
2017-04-27 21:26:15 +03:00
|
|
|
return api.services().then(services => {
|
|
|
|
return Object.keys(services).map(name => {
|
2016-10-10 18:37:26 +03:00
|
|
|
return {
|
|
|
|
url: services[name],
|
|
|
|
name
|
|
|
|
};
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|