{"action":"created","issue":{"url":"https://api.github.com/repos/strapi/strapi/issues/1417","repository_url":"https://api.github.com/repos/strapi/strapi","labels_url":"https://api.github.com/repos/strapi/strapi/issues/1417/labels{/name}","comments_url":"https://api.github.com/repos/strapi/strapi/issues/1417/comments","events_url":"https://api.github.com/repos/strapi/strapi/issues/1417/events","html_url":"https://github.com/strapi/strapi/issues/1417","id":333472285,"node_id":"MDU6SXNzdWUzMzM0NzIyODU=","number":1417,"title":"TypeError: strapi.hook.mongoose.manageRelations is not a function","user":{"login":"johntom","id":1877376,"node_id":"MDQ6VXNlcjE4NzczNzY=","avatar_url":"https://avatars2.githubusercontent.com/u/1877376?v=4","gravatar_id":"","url":"https://api.github.com/users/johntom","html_url":"https://github.com/johntom","followers_url":"https://api.github.com/users/johntom/followers","following_url":"https://api.github.com/users/johntom/following{/other_user}","gists_url":"https://api.github.com/users/johntom/gists{/gist_id}","starred_url":"https://api.github.com/users/johntom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johntom/subscriptions","organizations_url":"https://api.github.com/users/johntom/orgs","repos_url":"https://api.github.com/users/johntom/repos","events_url":"https://api.github.com/users/johntom/events{/privacy}","received_events_url":"https://api.github.com/users/johntom/received_events","type":"User","site_admin":false},"labels":[{"id":758313798,"node_id":"MDU6TGFiZWw3NTgzMTM3OTg=","url":"https://api.github.com/repos/strapi/strapi/labels/type:%20help%20wanted%20%F0%9F%A4%B7%E2%80%8D%E2%99%82%EF%B8%8F","name":"type: help wanted 🤷‍♂️","color":"1ed856","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":null,"comments":4,"created_at":"2018-06-18T23:45:43Z","updated_at":"2018-06-19T14:29:23Z","closed_at":null,"author_association":"NONE","body":"**Informations**\r\n- **Node.js version**:9.5.0\r\n- **npm version**:4.1.2\r\n- **Strapi version**:3.0.0-alpha.12.4\r\n- **Database**:Mongo v2.4.10\r\n- **Operating system**:win10\r\n\r\n\r\n**What is the current behavior?**\r\nPosting to articles from a custom form raises\r\n```\r\nservices article data Article { _id: 5b283e9553ad82716c4a17ea,\r\n  title: 'GTZ TEST ',\r\n  content: 'This is a test for adding article thru custom form',\r\n  createdAt: 2018-06-18T23:21:57.028Z,\r\n  updatedAt: 2018-06-18T23:21:57.028Z,\r\n  __v: 0,\r\n  contentImage: null,\r\n  id: '5b283e9553ad82716c4a17ea' }\r\nTypeError: strapi.hook.mongoose.manageRelations is not a function\r\n    at Object.add (D:\\Frameworks\\Strapi-Gatsby\\api\\api\\article\\services\\Article.js:54:32)\r\n    at <anonymous>\r\n    at process._tickCallback (internal/process/next_tick.js:160:7)\r\n[2018-06-18T23:21:57.036Z] debug POST /article (23 ms)\r\n```\r\n**Steps to reproduce the problem**\r\nadd a custom form in public folder also added socket.io\r\narticle.html \r\n```\r\n\r\n<section>\r\n    <h1>Add new article !</h1>\r\n\r\n    <label for=\"title\">\r\n        <span>Title :</span>\r\n        <!-- name of the bakery entity -->\r\n        <input type=\"text\" name=\"title\" id=\"title\" />\r\n    </label>\r\n    <label for=\"content\">\r\n        <span>Content :</span>\r\n        <!-- name of the bakery entity -->\r\n        <input type=\"text\" name=\"content\" id=\"content\" />\r\n    </label>\r\n\r\n\r\n    <button id=\"add\">Add</button>\r\n    <div id=\"article\"></div>\r\n</section>\r\n<script src=\"/socket.io/socket.io.js\"></script>\r\n<script>\r\n    const socket = io();\r\n\r\n    // to get the value name to create an entity\r\n    const name = document.getElementById('title');\r\n    // to get the value rating to create an entity\r\n    const content = document.getElementById('content');\r\n    // to listen to click event and send our request\r\n    const add = document.getElementById('add');\r\n    const article = document.getElementById('article');\r\n    socket.on('article_ready', res => article.innerHTML += `<div>- ${res.title} is ${res.content}/ is a good post</div>`);\r\n\r\n    add.addEventListener('click', () => { // listen to click event\r\n        // send a post request with our input value\r\n        fetch('/article', {\r\n            method: 'post',\r\n            headers: { \"Content-type\": \"application/x-www-form-urlencoded; charset=UTF-8\" },\r\n            body: `title=${title.value}&content=${content.value}`\r\n        })\r\n            .then((res) => {\r\n                if (res.status !== 200) return;\r\n                res.json().then((data) => console.log(data));\r\n            }\r\n            )\r\n            .catch((err) => console.log('Fetch Error :-S', err));\r\n    });\r\n</script>\r\n```\r\nwithout socketio using json payload\r\n```\r\n<section>\r\n    <h1>Add new article !</h1>\r\n\r\n    <label for=\"title\">\r\n        <span>Title :</span>\r\n        <!-- name of the bakery entity -->\r\n        <input type=\"text\" name=\"title\" id=\"title\" />\r\n    </label>\r\n    <label for=\"content\">\r\n        <span>Content :</span>\r\n        <!-- name of the bakery entity -->\r\n        <input type=\"text\" name=\"content\" id=\"content\" />\r\n    </label>\r\n\r\n\r\n    <button id=\"add\">Add</button>\r\n    <div id=\"article\"></div>\r\n</section>\r\n<!-- <script src=\"/socket.io/socket.io.js\"></script> -->\r\n<script>\r\n        const add = document.getElementById('add');\r\n        const article = document.getElementById('article');\r\n        add.addEventListener('click', () => { // listen to click event\r\n         \r\n    let product = {};\r\n    product.title = `${title.value}`;\r\n    product.content =  `${content.value}`;\r\n    // send a post request with our input value\r\n    fetch('/article', {\r\n        method: 'post',\r\n        headers: {\r\n            'Accept': 'application/json',\r\n            'Content-Type': 'application/json',\r\n        },\r\n       \r\n        body: JSON.stringify(product)\r\n    })\r\n        .then((res) => {\r\n            if (res.status !== 200) return;\r\n            res.json().then((data) => console.log(data));\r\n        }\r\n        )\r\n        .catch((err) => console.log('Fetch Error :-S', err));\r\n\r\n\r\n\r\n});\r\n\r\n</script>\r\n```\r\n\r\n**What is the expected behavior?**\r\nposting an artilcle though dashboard succeeds\r\n\r\n\r\n**Suggested solutions**\r\ncommenting out line await and post passes. Just not sure of any potential issues.\r\n  add: async (values) => {\r\n    const data = await Article.create(_.omit(values, _.keys(_.groupBy(strapi.models.article.associations, 'alias'))));\r\n    console.log('services bakery data Article',data)\r\n   \r\n  //  await strapi.hook.mongoose.manageRelations('article', _.merge(_.clone(data), { values }));\r\n    return data;\r\n  },\r\n\r\n<!-- ⚠️ Make sure to browse the opened and closed issues before submitting your issue. -->\r\ni found Relations not being saved with POST API request, only with PUT #919...\r\n"},"comment":{"url":"https://api.github.com/repos/strapi/strapi/issues/comments/398419496","html_url":"https://github.com/strapi/strapi/issues/1417#issuecomment-398419496","issue_url":"https://api.github.com/repos/strapi/strapi/issues/1417","id":398419496,"node_id":"MDEyOklzc3VlQ29tbWVudDM5ODQxOTQ5Ng==","user":{"login":"daru23","id":1735875,"node_id":"MDQ6VXNlcjE3MzU4NzU=","avatar_url":"https://avatars0.githubusercontent.com/u/1735875?v=4","gravatar_id":"","url":"https://api.github.com/users/daru23","html_url":"https://github.com/daru23","followers_url":"https://api.github.com/users/daru23/followers","following_url":"https://api.github.com/users/daru23/following{/other_user}","gists_url":"https://api.github.com/users/daru23/gists{/gist_id}","starred_url":"https://api.github.com/users/daru23/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/daru23/subscriptions","organizations_url":"https://api.github.com/users/daru23/orgs","repos_url":"https://api.github.com/users/daru23/repos","events_url":"https://api.github.com/users/daru23/events{/privacy}","received_events_url":"https://api.github.com/users/daru23/received_events","type":"User","site_admin":false},"created_at":"2018-06-19T14:29:23Z","updated_at":"2018-06-19T14:29:23Z","author_association":"NONE","body":"@derrickmehaffy Thanks a lot. Work smoothly for me. "}}
{"actor":{"display_login":"daru23"}}