mirror of
https://github.com/strapi/strapi.git
synced 2025-12-27 07:03:38 +00:00
Fix conflicts and update comments
This commit is contained in:
commit
92a1d0d516
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
"api",
|
||||
"auth",
|
||||
"framework",
|
||||
"graphql",
|
||||
"koa",
|
||||
"koajs",
|
||||
"lusca",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user