{"action":"created","issue":{"url":"https://api.github.com/repos/strapi/strapi/issues/2157","repository_url":"https://api.github.com/repos/strapi/strapi","labels_url":"https://api.github.com/repos/strapi/strapi/issues/2157/labels{/name}","comments_url":"https://api.github.com/repos/strapi/strapi/issues/2157/comments","events_url":"https://api.github.com/repos/strapi/strapi/issues/2157/events","html_url":"https://github.com/strapi/strapi/pull/2157","id":371176878,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIzNjgyNTI5","number":2157,"title":"Aggregation not work correctly","user":{"login":"jrperdomoz","id":2061711,"node_id":"MDQ6VXNlcjIwNjE3MTE=","avatar_url":"https://avatars1.githubusercontent.com/u/2061711?v=4","gravatar_id":"","url":"https://api.github.com/users/jrperdomoz","html_url":"https://github.com/jrperdomoz","followers_url":"https://api.github.com/users/jrperdomoz/followers","following_url":"https://api.github.com/users/jrperdomoz/following{/other_user}","gists_url":"https://api.github.com/users/jrperdomoz/gists{/gist_id}","starred_url":"https://api.github.com/users/jrperdomoz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrperdomoz/subscriptions","organizations_url":"https://api.github.com/users/jrperdomoz/orgs","repos_url":"https://api.github.com/users/jrperdomoz/repos","events_url":"https://api.github.com/users/jrperdomoz/events{/privacy}","received_events_url":"https://api.github.com/users/jrperdomoz/received_events","type":"User","site_admin":false},"labels":[{"id":881292887,"node_id":"MDU6TGFiZWw4ODEyOTI4ODc=","url":"https://api.github.com/repos/strapi/strapi/labels/pr:%20%F0%9F%90%9B%20Bug%20fix","name":"pr: 🐛 Bug fix","color":"fc2929","default":false},{"id":881296679,"node_id":"MDU6TGFiZWw4ODEyOTY2Nzk=","url":"https://api.github.com/repos/strapi/strapi/labels/source:%20Plugin","name":"source: Plugin","color":"105989","default":false}],"state":"open","locked":false,"assignee":{"login":"lauriejim","id":5716596,"node_id":"MDQ6VXNlcjU3MTY1OTY=","avatar_url":"https://avatars3.githubusercontent.com/u/5716596?v=4","gravatar_id":"","url":"https://api.github.com/users/lauriejim","html_url":"https://github.com/lauriejim","followers_url":"https://api.github.com/users/lauriejim/followers","following_url":"https://api.github.com/users/lauriejim/following{/other_user}","gists_url":"https://api.github.com/users/lauriejim/gists{/gist_id}","starred_url":"https://api.github.com/users/lauriejim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lauriejim/subscriptions","organizations_url":"https://api.github.com/users/lauriejim/orgs","repos_url":"https://api.github.com/users/lauriejim/repos","events_url":"https://api.github.com/users/lauriejim/events{/privacy}","received_events_url":"https://api.github.com/users/lauriejim/received_events","type":"User","site_admin":false},"assignees":[{"login":"lauriejim","id":5716596,"node_id":"MDQ6VXNlcjU3MTY1OTY=","avatar_url":"https://avatars3.githubusercontent.com/u/5716596?v=4","gravatar_id":"","url":"https://api.github.com/users/lauriejim","html_url":"https://github.com/lauriejim","followers_url":"https://api.github.com/users/lauriejim/followers","following_url":"https://api.github.com/users/lauriejim/following{/other_user}","gists_url":"https://api.github.com/users/lauriejim/gists{/gist_id}","starred_url":"https://api.github.com/users/lauriejim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lauriejim/subscriptions","organizations_url":"https://api.github.com/users/lauriejim/orgs","repos_url":"https://api.github.com/users/lauriejim/repos","events_url":"https://api.github.com/users/lauriejim/events{/privacy}","received_events_url":"https://api.github.com/users/lauriejim/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/strapi/strapi/milestones/31","html_url":"https://github.com/strapi/strapi/milestone/31","labels_url":"https://api.github.com/repos/strapi/strapi/milestones/31/labels","id":3770891,"node_id":"MDk6TWlsZXN0b25lMzc3MDg5MQ==","number":31,"title":"3.0.0-alpha.14.5","description":"","creator":{"login":"lauriejim","id":5716596,"node_id":"MDQ6VXNlcjU3MTY1OTY=","avatar_url":"https://avatars3.githubusercontent.com/u/5716596?v=4","gravatar_id":"","url":"https://api.github.com/users/lauriejim","html_url":"https://github.com/lauriejim","followers_url":"https://api.github.com/users/lauriejim/followers","following_url":"https://api.github.com/users/lauriejim/following{/other_user}","gists_url":"https://api.github.com/users/lauriejim/gists{/gist_id}","starred_url":"https://api.github.com/users/lauriejim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lauriejim/subscriptions","organizations_url":"https://api.github.com/users/lauriejim/orgs","repos_url":"https://api.github.com/users/lauriejim/repos","events_url":"https://api.github.com/users/lauriejim/events{/privacy}","received_events_url":"https://api.github.com/users/lauriejim/received_events","type":"User","site_admin":false},"open_issues":12,"closed_issues":19,"state":"open","created_at":"2018-10-26T07:28:51Z","updated_at":"2018-11-01T16:39:58Z","due_on":"2018-11-13T08:00:00Z","closed_at":null},"comments":8,"created_at":"2018-10-17T17:01:49Z","updated_at":"2018-11-02T17:45:24Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/strapi/strapi/pulls/2157","html_url":"https://github.com/strapi/strapi/pull/2157","diff_url":"https://github.com/strapi/strapi/pull/2157.diff","patch_url":"https://github.com/strapi/strapi/pull/2157.patch"},"body":"<!-- ⚠️ Your PR title will appear in the changelogs please make it short detailed and understandable for all. -->\r\n\r\n<!-- Uncomment the correct contribution type. !-->\r\n\r\nMy PR is a:\r\n🐛 Bug fix #2151\r\n\r\nMain update on the:\r\nPlugin: graphql\r\n\r\nValues ​​and counting are resolved correctly.  I solve the errors detailed in the number #2151 \r\n"},"comment":{"url":"https://api.github.com/repos/strapi/strapi/issues/comments/435457290","html_url":"https://github.com/strapi/strapi/pull/2157#issuecomment-435457290","issue_url":"https://api.github.com/repos/strapi/strapi/issues/2157","id":435457290,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNTQ1NzI5MA==","user":{"login":"Aurelsicoko","id":4144726,"node_id":"MDQ6VXNlcjQxNDQ3MjY=","avatar_url":"https://avatars0.githubusercontent.com/u/4144726?v=4","gravatar_id":"","url":"https://api.github.com/users/Aurelsicoko","html_url":"https://github.com/Aurelsicoko","followers_url":"https://api.github.com/users/Aurelsicoko/followers","following_url":"https://api.github.com/users/Aurelsicoko/following{/other_user}","gists_url":"https://api.github.com/users/Aurelsicoko/gists{/gist_id}","starred_url":"https://api.github.com/users/Aurelsicoko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Aurelsicoko/subscriptions","organizations_url":"https://api.github.com/users/Aurelsicoko/orgs","repos_url":"https://api.github.com/users/Aurelsicoko/repos","events_url":"https://api.github.com/users/Aurelsicoko/events{/privacy}","received_events_url":"https://api.github.com/users/Aurelsicoko/received_events","type":"User","site_admin":false},"created_at":"2018-11-02T17:45:24Z","updated_at":"2018-11-02T17:45:24Z","author_association":"CONTRIBUTOR","body":"We should be able to call the function through `strapi.hook.mongoose.utils.buildOr()`. However, the utils are not exposed in the `strapi.hook.mongoose` object. It means we need to edit the file https://github.com/strapi/strapi/blob/master/packages/strapi/lib/core/hooks.js like this\r\n\r\n```js\r\n'use strict';\r\n\r\n// Dependencies.\r\nconst path = require('path');\r\nconst glob = require('glob');\r\nconst { parallel } = require('async');\r\nconst { endsWith, get, set } = require('lodash');\r\n\r\nmodule.exports = function() {\r\n  this.hook = {};\r\n\r\n  return Promise.all([\r\n    new Promise((resolve, reject) => {\r\n      const cwd = this.config.appPath;\r\n\r\n      // Load configurations.\r\n      glob('./node_modules/*(strapi-hook-*)/!(node_modules)/**/*.*(js|json)', {\r\n        cwd\r\n      }, (err, files) => {\r\n        if (err) {\r\n          return reject(err);\r\n        }\r\n\r\n        mountHooks.call(this, files, cwd, 'node_modules')(resolve, reject);\r\n      });\r\n    }),\r\n    new Promise((resolve, reject) => {\r\n      const cwd = path.resolve(this.config.appPath, 'hooks');\r\n\r\n      // Load configurations.\r\n      glob('./**/*.*(js|json)', {\r\n        cwd\r\n      }, (err, files) => {\r\n        if (err) {\r\n          return reject(err);\r\n        }\r\n\r\n        mountHooks.call(this, files, cwd)(resolve, reject);\r\n      });\r\n    }),\r\n    new Promise((resolve, reject) => {\r\n      const cwd = path.resolve(this.config.appPath, 'plugins');\r\n\r\n      // Load configurations.\r\n      glob('./*/hooks/**/*.*(js|json)', {\r\n        cwd\r\n      }, (err, files) => {\r\n        if (err) {\r\n          return reject(err);\r\n        }\r\n\r\n        mountHooks.call(this, files, cwd, 'plugins')(resolve, reject);\r\n      });\r\n    })\r\n  ]);\r\n};\r\n\r\nconst mountHooks = function (files, cwd, source) {\r\n  return (resolve, reject) =>\r\n    parallel(\r\n      files.map(p => cb => {\r\n        const folders = p.replace(/^.\\/node_modules\\/strapi-hook-/, './')\r\n          .split('/');\r\n        const name = source === 'plugins' ? folders[folders.length - 2] : folders[1];\r\n\r\n        this.hook[name] = this.hook[name] || {\r\n          loaded: false\r\n        };\r\n\r\n        let dependencies = [];\r\n        if (source === 'node_modules') {\r\n          try {\r\n            dependencies = get(require(path.resolve(this.config.appPath, 'node_modules', `strapi-hook-${name}`, 'package.json')), 'strapi.dependencies', []);\r\n          } catch(err) {\r\n            // Silent\r\n          }\r\n        }\r\n\r\n        if (endsWith(p, 'index.js') && !this.hook[name].load) {\r\n          // Lazy loading.\r\n          Object.defineProperty(this.hook[name], 'load', {\r\n            configurable: false,\r\n            enumerable: true,\r\n            get: () => require(path.resolve(cwd, p)),\r\n            dependencies\r\n          });\r\n\r\n          this.hook[name].dependencies = dependencies;\r\n        } else {\r\n          const splitPath = p.split('/');\r\n          const objectPath = splitPath.slice(splitPath.indexOf('lib') + 1).map(name => name.replace('.js', ''));\r\n\r\n          set(this.hook, [name].concat(objectPath), require(path.resolve(cwd, p)));\r\n        }\r\n\r\n        cb();\r\n      }),\r\n      (err) => {\r\n        if (err) {\r\n          return reject(err);\r\n        }\r\n\r\n        resolve();\r\n      }\r\n    );\r\n};\r\n```\r\n\r\nThen, you'll be able to retrive the utils via `strapi.hook.mongoose.utils.buildOr()`."}}
{"actor":{"display_login":"Aurelsicoko"}}