{"action":"created","comment":{"url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/pulls/comments/42329793","id":42329793,"diff_hunk":"@@ -0,0 +1,137 @@\n+/**\n+ * PostController\n+ *\n+ * @description :: Server-side logic for managing posts\n+ * @help        :: See http://sailsjs.org/#!/documentation/concepts/Controllers\n+ */\n+\n+module.exports = {\n+\t\n+\t// Create Post  \n+\tcreate: function(req, res, next) {\n+\n+    var params = req.params.all();\n+\n+    Post.create(params, function(err, sleep) {\n+\n+        if (err) return next(err);\n+\n+        res.status(201);\n+\n+        res.json(sleep);\n+\n+    });\n+},\n+\n+   // Find Posts\n+find: function (req, res, next) {\n+\n+  var id = req.param('id');\n+\n+  var idShortCut = isShortcut(id);\n+\n+  if (idShortCut === true) {\n+      return next();\n+  }\n+\n+  if (id) {\n+\n+      Post.findOne(id, function(err, post) {\n+\n+          if(post === undefined) return res.notFound();\n+\n+          if (err) return next(err);\n+\n+          res.json(post);\n+\n+      });\n+\n+  } else {\n+\n+      var where = req.param('where');\n+\n+      if (_.isString(where)) {\n+              where = JSON.parse(where);\n+      }\n+\n+\n+\n+      var options = {\n+                  limit: req.param('limit') || undefined,\n+                  skip: req.param('skip')  || undefined,\n+                  sort: req.param('sort') || undefined,\n+                  where: where || undefined\n+          };\n+\n+          console.log(\"This is the options\", options);\n+              \n+      Post.find(options, function(err, post) {\n+\n+          if(post === undefined) return res.notFound();\n+\n+          if (err) return next(err);\n+\n+          res.json(post);\n+\n+      });\n+\n+  }\n+\n+  function isShortcut(id) {\n+      if (id === 'find'   ||  id === 'update' ||  id === 'create' ||  id === 'destroy') {\n+      return true;\n+      }\n+  }\n+\n+},\n+\n+// Update Post\n+    update: function (req, res, next) {\n+\n+        var criteria = {};\n+\n+        criteria = _.merge({}, req.params.all(), req.body);\n+\n+        var id = req.param('id');\n+\n+        if (!id) {\n+            return res.badRequest('No id provided.');\n+        }\n+\n+        Post.update(id, criteria, function (err, post) {\n+\n+            if(post.length === 0) return res.notFound();\n+\n+            if (err) return next(err);\n+\n+            res.json(post);\n+\n+        });\n+    },\n+\t\n+\t// Delete Post\n+    destroy: function (req, res, next) {\n+\n+        var id = req.param('id');\n+\n+        if (!id) {\n+            return res.badRequest('No id provided.');\n+        }\n+\n+        Post.findOne(id).done(function(err, result) {","path":"api/controllers/PostController.js","position":121,"original_position":121,"commit_id":"83e7e43c2c52dd8f6dd4166b643362e607e85496","original_commit_id":"83e7e43c2c52dd8f6dd4166b643362e607e85496","user":{"login":"FruitPunchSamuraiG","id":2347578,"avatar_url":"https://avatars.githubusercontent.com/u/2347578?v=3","gravatar_id":"","url":"https://api.github.com/users/FruitPunchSamuraiG","html_url":"https://github.com/FruitPunchSamuraiG","followers_url":"https://api.github.com/users/FruitPunchSamuraiG/followers","following_url":"https://api.github.com/users/FruitPunchSamuraiG/following{/other_user}","gists_url":"https://api.github.com/users/FruitPunchSamuraiG/gists{/gist_id}","starred_url":"https://api.github.com/users/FruitPunchSamuraiG/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FruitPunchSamuraiG/subscriptions","organizations_url":"https://api.github.com/users/FruitPunchSamuraiG/orgs","repos_url":"https://api.github.com/users/FruitPunchSamuraiG/repos","events_url":"https://api.github.com/users/FruitPunchSamuraiG/events{/privacy}","received_events_url":"https://api.github.com/users/FruitPunchSamuraiG/received_events","type":"User","site_admin":false},"body":"Change to -> Post.findOne(id, function(err, result) {\r\n","created_at":"2015-10-19T00:44:26Z","updated_at":"2015-10-19T00:44:26Z","html_url":"https://github.com/BarriePetCareTeam/MainSite/pull/3#discussion_r42329793","pull_request_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/BarriePetCareTeam/MainSite/pulls/comments/42329793"},"html":{"href":"https://github.com/BarriePetCareTeam/MainSite/pull/3#discussion_r42329793"},"pull_request":{"href":"https://api.github.com/repos/BarriePetCareTeam/MainSite/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/pulls/3","id":48012923,"html_url":"https://github.com/BarriePetCareTeam/MainSite/pull/3","diff_url":"https://github.com/BarriePetCareTeam/MainSite/pull/3.diff","patch_url":"https://github.com/BarriePetCareTeam/MainSite/pull/3.patch","issue_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/issues/3","number":3,"state":"open","locked":false,"title":"Post api","user":{"login":"khrisdickson","id":2466072,"avatar_url":"https://avatars.githubusercontent.com/u/2466072?v=3","gravatar_id":"","url":"https://api.github.com/users/khrisdickson","html_url":"https://github.com/khrisdickson","followers_url":"https://api.github.com/users/khrisdickson/followers","following_url":"https://api.github.com/users/khrisdickson/following{/other_user}","gists_url":"https://api.github.com/users/khrisdickson/gists{/gist_id}","starred_url":"https://api.github.com/users/khrisdickson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/khrisdickson/subscriptions","organizations_url":"https://api.github.com/users/khrisdickson/orgs","repos_url":"https://api.github.com/users/khrisdickson/repos","events_url":"https://api.github.com/users/khrisdickson/events{/privacy}","received_events_url":"https://api.github.com/users/khrisdickson/received_events","type":"User","site_admin":false},"body":"Added CRUD operations for the posting api","created_at":"2015-10-18T17:25:29Z","updated_at":"2015-10-19T00:44:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":{"login":"aalmacin","id":2699288,"avatar_url":"https://avatars.githubusercontent.com/u/2699288?v=3","gravatar_id":"","url":"https://api.github.com/users/aalmacin","html_url":"https://github.com/aalmacin","followers_url":"https://api.github.com/users/aalmacin/followers","following_url":"https://api.github.com/users/aalmacin/following{/other_user}","gists_url":"https://api.github.com/users/aalmacin/gists{/gist_id}","starred_url":"https://api.github.com/users/aalmacin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aalmacin/subscriptions","organizations_url":"https://api.github.com/users/aalmacin/orgs","repos_url":"https://api.github.com/users/aalmacin/repos","events_url":"https://api.github.com/users/aalmacin/events{/privacy}","received_events_url":"https://api.github.com/users/aalmacin/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/pulls/3/commits","review_comments_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/pulls/3/comments","review_comment_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/pulls/comments{/number}","comments_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/issues/3/comments","statuses_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/statuses/83e7e43c2c52dd8f6dd4166b643362e607e85496","head":{"label":"BarriePetCareTeam:post-api","ref":"post-api","sha":"83e7e43c2c52dd8f6dd4166b643362e607e85496","user":{"login":"BarriePetCareTeam","id":14079123,"avatar_url":"https://avatars.githubusercontent.com/u/14079123?v=3","gravatar_id":"","url":"https://api.github.com/users/BarriePetCareTeam","html_url":"https://github.com/BarriePetCareTeam","followers_url":"https://api.github.com/users/BarriePetCareTeam/followers","following_url":"https://api.github.com/users/BarriePetCareTeam/following{/other_user}","gists_url":"https://api.github.com/users/BarriePetCareTeam/gists{/gist_id}","starred_url":"https://api.github.com/users/BarriePetCareTeam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BarriePetCareTeam/subscriptions","organizations_url":"https://api.github.com/users/BarriePetCareTeam/orgs","repos_url":"https://api.github.com/users/BarriePetCareTeam/repos","events_url":"https://api.github.com/users/BarriePetCareTeam/events{/privacy}","received_events_url":"https://api.github.com/users/BarriePetCareTeam/received_events","type":"Organization","site_admin":false},"repo":{"id":43812898,"name":"MainSite","full_name":"BarriePetCareTeam/MainSite","owner":{"login":"BarriePetCareTeam","id":14079123,"avatar_url":"https://avatars.githubusercontent.com/u/14079123?v=3","gravatar_id":"","url":"https://api.github.com/users/BarriePetCareTeam","html_url":"https://github.com/BarriePetCareTeam","followers_url":"https://api.github.com/users/BarriePetCareTeam/followers","following_url":"https://api.github.com/users/BarriePetCareTeam/following{/other_user}","gists_url":"https://api.github.com/users/BarriePetCareTeam/gists{/gist_id}","starred_url":"https://api.github.com/users/BarriePetCareTeam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BarriePetCareTeam/subscriptions","organizations_url":"https://api.github.com/users/BarriePetCareTeam/orgs","repos_url":"https://api.github.com/users/BarriePetCareTeam/repos","events_url":"https://api.github.com/users/BarriePetCareTeam/events{/privacy}","received_events_url":"https://api.github.com/users/BarriePetCareTeam/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/BarriePetCareTeam/MainSite","description":"","fork":false,"url":"https://api.github.com/repos/BarriePetCareTeam/MainSite","forks_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/forks","keys_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/teams","hooks_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/hooks","issue_events_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/issues/events{/number}","events_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/events","assignees_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/assignees{/user}","branches_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/branches{/branch}","tags_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/tags","blobs_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/git/refs{/sha}","trees_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/statuses/{sha}","languages_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/languages","stargazers_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/stargazers","contributors_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/contributors","subscribers_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/subscribers","subscription_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/subscription","commits_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/commits{/sha}","git_commits_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/git/commits{/sha}","comments_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/comments{/number}","issue_comment_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/issues/comments{/number}","contents_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/contents/{+path}","compare_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/merges","archive_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/downloads","issues_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/issues{/number}","pulls_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/pulls{/number}","milestones_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/milestones{/number}","notifications_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/labels{/name}","releases_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/releases{/id}","created_at":"2015-10-07T12:04:03Z","updated_at":"2015-10-07T12:05:26Z","pushed_at":"2015-10-18T17:25:29Z","git_url":"git://github.com/BarriePetCareTeam/MainSite.git","ssh_url":"git@github.com:BarriePetCareTeam/MainSite.git","clone_url":"https://github.com/BarriePetCareTeam/MainSite.git","svn_url":"https://github.com/BarriePetCareTeam/MainSite","homepage":null,"size":248,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"BarriePetCareTeam:master","ref":"master","sha":"5b690b78d6052f08c12785d0c1af0f5abb942777","user":{"login":"BarriePetCareTeam","id":14079123,"avatar_url":"https://avatars.githubusercontent.com/u/14079123?v=3","gravatar_id":"","url":"https://api.github.com/users/BarriePetCareTeam","html_url":"https://github.com/BarriePetCareTeam","followers_url":"https://api.github.com/users/BarriePetCareTeam/followers","following_url":"https://api.github.com/users/BarriePetCareTeam/following{/other_user}","gists_url":"https://api.github.com/users/BarriePetCareTeam/gists{/gist_id}","starred_url":"https://api.github.com/users/BarriePetCareTeam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BarriePetCareTeam/subscriptions","organizations_url":"https://api.github.com/users/BarriePetCareTeam/orgs","repos_url":"https://api.github.com/users/BarriePetCareTeam/repos","events_url":"https://api.github.com/users/BarriePetCareTeam/events{/privacy}","received_events_url":"https://api.github.com/users/BarriePetCareTeam/received_events","type":"Organization","site_admin":false},"repo":{"id":43812898,"name":"MainSite","full_name":"BarriePetCareTeam/MainSite","owner":{"login":"BarriePetCareTeam","id":14079123,"avatar_url":"https://avatars.githubusercontent.com/u/14079123?v=3","gravatar_id":"","url":"https://api.github.com/users/BarriePetCareTeam","html_url":"https://github.com/BarriePetCareTeam","followers_url":"https://api.github.com/users/BarriePetCareTeam/followers","following_url":"https://api.github.com/users/BarriePetCareTeam/following{/other_user}","gists_url":"https://api.github.com/users/BarriePetCareTeam/gists{/gist_id}","starred_url":"https://api.github.com/users/BarriePetCareTeam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BarriePetCareTeam/subscriptions","organizations_url":"https://api.github.com/users/BarriePetCareTeam/orgs","repos_url":"https://api.github.com/users/BarriePetCareTeam/repos","events_url":"https://api.github.com/users/BarriePetCareTeam/events{/privacy}","received_events_url":"https://api.github.com/users/BarriePetCareTeam/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/BarriePetCareTeam/MainSite","description":"","fork":false,"url":"https://api.github.com/repos/BarriePetCareTeam/MainSite","forks_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/forks","keys_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/teams","hooks_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/hooks","issue_events_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/issues/events{/number}","events_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/events","assignees_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/assignees{/user}","branches_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/branches{/branch}","tags_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/tags","blobs_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/git/refs{/sha}","trees_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/statuses/{sha}","languages_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/languages","stargazers_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/stargazers","contributors_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/contributors","subscribers_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/subscribers","subscription_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/subscription","commits_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/commits{/sha}","git_commits_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/git/commits{/sha}","comments_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/comments{/number}","issue_comment_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/issues/comments{/number}","contents_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/contents/{+path}","compare_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/merges","archive_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/downloads","issues_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/issues{/number}","pulls_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/pulls{/number}","milestones_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/milestones{/number}","notifications_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/labels{/name}","releases_url":"https://api.github.com/repos/BarriePetCareTeam/MainSite/releases{/id}","created_at":"2015-10-07T12:04:03Z","updated_at":"2015-10-07T12:05:26Z","pushed_at":"2015-10-18T17:25:29Z","git_url":"git://github.com/BarriePetCareTeam/MainSite.git","ssh_url":"git@github.com:BarriePetCareTeam/MainSite.git","clone_url":"https://github.com/BarriePetCareTeam/MainSite.git","svn_url":"https://github.com/BarriePetCareTeam/MainSite","homepage":null,"size":248,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/BarriePetCareTeam/MainSite/pulls/3"},"html":{"href":"https://github.com/BarriePetCareTeam/MainSite/pull/3"},"issue":{"href":"https://api.github.com/repos/BarriePetCareTeam/MainSite/issues/3"},"comments":{"href":"https://api.github.com/repos/BarriePetCareTeam/MainSite/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/BarriePetCareTeam/MainSite/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/BarriePetCareTeam/MainSite/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/BarriePetCareTeam/MainSite/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/BarriePetCareTeam/MainSite/statuses/83e7e43c2c52dd8f6dd4166b643362e607e85496"}}}}