Fix conflicts and update comments

This commit is contained in:
Aurélien Georget 2015-10-19 22:10:29 +02:00
commit 92a1d0d516
4 changed files with 5 additions and 4 deletions

View File

@ -88,7 +88,7 @@ module.exports = function (strapi) {
if (strapi.config.globals.graphql === true || _.isPlainObject(strapi.config.globals.graphql)) {
const GraphQLPath = _.isBoolean(strapi.config.globals.graphql) ? '/graphql' : strapi.config.globals.graphql.path;
// Define GraphQL route with transformed Waterline models to GraphQL schema
// Define GraphQL route with modified Waterline models to GraphQL schema
strapi.router.get(GraphQLPath, strapi.middlewares.graphql({
schema: strapi.schemas,
pretty: true

View File

@ -181,14 +181,14 @@ module.exports = function (strapi) {
});
if (strapi.config.globals.graphql === true) {
// Add associations array in each collection
// Parse each models and add associations array
_.forEach(strapi.orm.collections, function(collection, key) {
if (strapi.models.hasOwnProperty(key)) {
collection.associations = strapi.models[key].associations || [];
}
});
// Expose models as schemas for GraphQL.
// Expose the GraphQL schemas at `strapi.schemas`
strapi.schemas = WaterlineGraphQL.getGraphQLSchema({
collections: strapi.orm.collections,
usefulFunctions: true

View File

@ -35,10 +35,10 @@ module.exports = function exposeGlobals() {
global.strapi = self;
}
// Extend GraphQL if enabled.
if (self.config.globals.graphql !== false) {
global.graphql = require('graphql');
// Extend GraphQL framework
global.graphql.query = function * (query) {
const deferred = Promise.defer();

View File

@ -7,6 +7,7 @@
"api",
"auth",
"framework",
"graphql",
"koa",
"koajs",
"lusca",