{"action":"created","comment":{"url":"https://api.github.com/repos/developer-news-brazil/www/pulls/comments/51179936","id":51179936,"diff_hunk":"@@ -0,0 +1,35 @@\n+import fs from 'fs';\n+import path from 'path';\n+import Sequelize from 'sequelize';\n+\n+import config from 'app/helpers/configLoader';\n+\n+const database = config('database');\n+\n+const sequelize = new Sequelize(database.database,\n+                                database.username,\n+                                database.password,\n+                                database);\n+\n+const models = {};\n+\n+const modelsPath = path.join(process.env.NODE_PATH, 'app', 'models');\n+\n+fs.readdirSync(modelsPath)\n+  .filter((file) => file.indexOf('.') !== 0 && file.indexOf('index.js') !== 0)\n+  .forEach((file) => {\n+    let model = sequelize.import(path.join(modelsPath, file));\n+    models[file.split('.')[0]] = model;\n+  });\n+\n+Object.keys(models).forEach((modelName) => {\n+  if('associate' in models[modelName]) {\n+    models[modelName].associate(models);\n+  }\n+});\n+\n+export { models };\n+\n+export default (callback) => {\n+  return sequelize.sync().then(() => callback(models));","path":"app/helpers/databaseLoader.js","position":34,"original_position":34,"commit_id":"6b205c1d28c26b2de6c2205d9d4dea6fb7679179","original_commit_id":"6b205c1d28c26b2de6c2205d9d4dea6fb7679179","user":{"login":"talyssonoc","id":4325587,"avatar_url":"https://avatars.githubusercontent.com/u/4325587?v=3","gravatar_id":"","url":"https://api.github.com/users/talyssonoc","html_url":"https://github.com/talyssonoc","followers_url":"https://api.github.com/users/talyssonoc/followers","following_url":"https://api.github.com/users/talyssonoc/following{/other_user}","gists_url":"https://api.github.com/users/talyssonoc/gists{/gist_id}","starred_url":"https://api.github.com/users/talyssonoc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/talyssonoc/subscriptions","organizations_url":"https://api.github.com/users/talyssonoc/orgs","repos_url":"https://api.github.com/users/talyssonoc/repos","events_url":"https://api.github.com/users/talyssonoc/events{/privacy}","received_events_url":"https://api.github.com/users/talyssonoc/received_events","type":"User","site_admin":false},"body":"Boa, verdade.","created_at":"2016-01-28T20:10:10Z","updated_at":"2016-01-28T20:10:10Z","html_url":"https://github.com/developer-news-brazil/www/pull/7#discussion_r51179936","pull_request_url":"https://api.github.com/repos/developer-news-brazil/www/pulls/7","_links":{"self":{"href":"https://api.github.com/repos/developer-news-brazil/www/pulls/comments/51179936"},"html":{"href":"https://github.com/developer-news-brazil/www/pull/7#discussion_r51179936"},"pull_request":{"href":"https://api.github.com/repos/developer-news-brazil/www/pulls/7"}}},"pull_request":{"url":"https://api.github.com/repos/developer-news-brazil/www/pulls/7","id":57556914,"html_url":"https://github.com/developer-news-brazil/www/pull/7","diff_url":"https://github.com/developer-news-brazil/www/pull/7.diff","patch_url":"https://github.com/developer-news-brazil/www/pull/7.patch","issue_url":"https://api.github.com/repos/developer-news-brazil/www/issues/7","number":7,"state":"open","locked":false,"title":"Feat/setup database","user":{"login":"talyssonoc","id":4325587,"avatar_url":"https://avatars.githubusercontent.com/u/4325587?v=3","gravatar_id":"","url":"https://api.github.com/users/talyssonoc","html_url":"https://github.com/talyssonoc","followers_url":"https://api.github.com/users/talyssonoc/followers","following_url":"https://api.github.com/users/talyssonoc/following{/other_user}","gists_url":"https://api.github.com/users/talyssonoc/gists{/gist_id}","starred_url":"https://api.github.com/users/talyssonoc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/talyssonoc/subscriptions","organizations_url":"https://api.github.com/users/talyssonoc/orgs","repos_url":"https://api.github.com/users/talyssonoc/repos","events_url":"https://api.github.com/users/talyssonoc/events{/privacy}","received_events_url":"https://api.github.com/users/talyssonoc/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-01-28T20:00:12Z","updated_at":"2016-01-28T20:10:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"adbb20b914d33e2e03c82d83e82c0b1762b59b77","assignee":{"login":"fernandofleury","id":2780941,"avatar_url":"https://avatars.githubusercontent.com/u/2780941?v=3","gravatar_id":"","url":"https://api.github.com/users/fernandofleury","html_url":"https://github.com/fernandofleury","followers_url":"https://api.github.com/users/fernandofleury/followers","following_url":"https://api.github.com/users/fernandofleury/following{/other_user}","gists_url":"https://api.github.com/users/fernandofleury/gists{/gist_id}","starred_url":"https://api.github.com/users/fernandofleury/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fernandofleury/subscriptions","organizations_url":"https://api.github.com/users/fernandofleury/orgs","repos_url":"https://api.github.com/users/fernandofleury/repos","events_url":"https://api.github.com/users/fernandofleury/events{/privacy}","received_events_url":"https://api.github.com/users/fernandofleury/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/developer-news-brazil/www/pulls/7/commits","review_comments_url":"https://api.github.com/repos/developer-news-brazil/www/pulls/7/comments","review_comment_url":"https://api.github.com/repos/developer-news-brazil/www/pulls/comments{/number}","comments_url":"https://api.github.com/repos/developer-news-brazil/www/issues/7/comments","statuses_url":"https://api.github.com/repos/developer-news-brazil/www/statuses/6b205c1d28c26b2de6c2205d9d4dea6fb7679179","head":{"label":"developer-news-brazil:feat/setup-database","ref":"feat/setup-database","sha":"6b205c1d28c26b2de6c2205d9d4dea6fb7679179","user":{"login":"developer-news-brazil","id":16595129,"avatar_url":"https://avatars.githubusercontent.com/u/16595129?v=3","gravatar_id":"","url":"https://api.github.com/users/developer-news-brazil","html_url":"https://github.com/developer-news-brazil","followers_url":"https://api.github.com/users/developer-news-brazil/followers","following_url":"https://api.github.com/users/developer-news-brazil/following{/other_user}","gists_url":"https://api.github.com/users/developer-news-brazil/gists{/gist_id}","starred_url":"https://api.github.com/users/developer-news-brazil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/developer-news-brazil/subscriptions","organizations_url":"https://api.github.com/users/developer-news-brazil/orgs","repos_url":"https://api.github.com/users/developer-news-brazil/repos","events_url":"https://api.github.com/users/developer-news-brazil/events{/privacy}","received_events_url":"https://api.github.com/users/developer-news-brazil/received_events","type":"Organization","site_admin":false},"repo":{"id":49219545,"name":"www","full_name":"developer-news-brazil/www","owner":{"login":"developer-news-brazil","id":16595129,"avatar_url":"https://avatars.githubusercontent.com/u/16595129?v=3","gravatar_id":"","url":"https://api.github.com/users/developer-news-brazil","html_url":"https://github.com/developer-news-brazil","followers_url":"https://api.github.com/users/developer-news-brazil/followers","following_url":"https://api.github.com/users/developer-news-brazil/following{/other_user}","gists_url":"https://api.github.com/users/developer-news-brazil/gists{/gist_id}","starred_url":"https://api.github.com/users/developer-news-brazil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/developer-news-brazil/subscriptions","organizations_url":"https://api.github.com/users/developer-news-brazil/orgs","repos_url":"https://api.github.com/users/developer-news-brazil/repos","events_url":"https://api.github.com/users/developer-news-brazil/events{/privacy}","received_events_url":"https://api.github.com/users/developer-news-brazil/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/developer-news-brazil/www","description":"","fork":false,"url":"https://api.github.com/repos/developer-news-brazil/www","forks_url":"https://api.github.com/repos/developer-news-brazil/www/forks","keys_url":"https://api.github.com/repos/developer-news-brazil/www/keys{/key_id}","collaborators_url":"https://api.github.com/repos/developer-news-brazil/www/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/developer-news-brazil/www/teams","hooks_url":"https://api.github.com/repos/developer-news-brazil/www/hooks","issue_events_url":"https://api.github.com/repos/developer-news-brazil/www/issues/events{/number}","events_url":"https://api.github.com/repos/developer-news-brazil/www/events","assignees_url":"https://api.github.com/repos/developer-news-brazil/www/assignees{/user}","branches_url":"https://api.github.com/repos/developer-news-brazil/www/branches{/branch}","tags_url":"https://api.github.com/repos/developer-news-brazil/www/tags","blobs_url":"https://api.github.com/repos/developer-news-brazil/www/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/developer-news-brazil/www/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/developer-news-brazil/www/git/refs{/sha}","trees_url":"https://api.github.com/repos/developer-news-brazil/www/git/trees{/sha}","statuses_url":"https://api.github.com/repos/developer-news-brazil/www/statuses/{sha}","languages_url":"https://api.github.com/repos/developer-news-brazil/www/languages","stargazers_url":"https://api.github.com/repos/developer-news-brazil/www/stargazers","contributors_url":"https://api.github.com/repos/developer-news-brazil/www/contributors","subscribers_url":"https://api.github.com/repos/developer-news-brazil/www/subscribers","subscription_url":"https://api.github.com/repos/developer-news-brazil/www/subscription","commits_url":"https://api.github.com/repos/developer-news-brazil/www/commits{/sha}","git_commits_url":"https://api.github.com/repos/developer-news-brazil/www/git/commits{/sha}","comments_url":"https://api.github.com/repos/developer-news-brazil/www/comments{/number}","issue_comment_url":"https://api.github.com/repos/developer-news-brazil/www/issues/comments{/number}","contents_url":"https://api.github.com/repos/developer-news-brazil/www/contents/{+path}","compare_url":"https://api.github.com/repos/developer-news-brazil/www/compare/{base}...{head}","merges_url":"https://api.github.com/repos/developer-news-brazil/www/merges","archive_url":"https://api.github.com/repos/developer-news-brazil/www/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/developer-news-brazil/www/downloads","issues_url":"https://api.github.com/repos/developer-news-brazil/www/issues{/number}","pulls_url":"https://api.github.com/repos/developer-news-brazil/www/pulls{/number}","milestones_url":"https://api.github.com/repos/developer-news-brazil/www/milestones{/number}","notifications_url":"https://api.github.com/repos/developer-news-brazil/www/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/developer-news-brazil/www/labels{/name}","releases_url":"https://api.github.com/repos/developer-news-brazil/www/releases{/id}","deployments_url":"https://api.github.com/repos/developer-news-brazil/www/deployments","created_at":"2016-01-07T17:30:15Z","updated_at":"2016-01-11T17:37:12Z","pushed_at":"2016-01-28T20:00:12Z","git_url":"git://github.com/developer-news-brazil/www.git","ssh_url":"git@github.com:developer-news-brazil/www.git","clone_url":"https://github.com/developer-news-brazil/www.git","svn_url":"https://github.com/developer-news-brazil/www","homepage":null,"size":21,"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":"developer-news-brazil:master","ref":"master","sha":"742a8f267cc15621056f04f59c0b7fbb4555a2f3","user":{"login":"developer-news-brazil","id":16595129,"avatar_url":"https://avatars.githubusercontent.com/u/16595129?v=3","gravatar_id":"","url":"https://api.github.com/users/developer-news-brazil","html_url":"https://github.com/developer-news-brazil","followers_url":"https://api.github.com/users/developer-news-brazil/followers","following_url":"https://api.github.com/users/developer-news-brazil/following{/other_user}","gists_url":"https://api.github.com/users/developer-news-brazil/gists{/gist_id}","starred_url":"https://api.github.com/users/developer-news-brazil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/developer-news-brazil/subscriptions","organizations_url":"https://api.github.com/users/developer-news-brazil/orgs","repos_url":"https://api.github.com/users/developer-news-brazil/repos","events_url":"https://api.github.com/users/developer-news-brazil/events{/privacy}","received_events_url":"https://api.github.com/users/developer-news-brazil/received_events","type":"Organization","site_admin":false},"repo":{"id":49219545,"name":"www","full_name":"developer-news-brazil/www","owner":{"login":"developer-news-brazil","id":16595129,"avatar_url":"https://avatars.githubusercontent.com/u/16595129?v=3","gravatar_id":"","url":"https://api.github.com/users/developer-news-brazil","html_url":"https://github.com/developer-news-brazil","followers_url":"https://api.github.com/users/developer-news-brazil/followers","following_url":"https://api.github.com/users/developer-news-brazil/following{/other_user}","gists_url":"https://api.github.com/users/developer-news-brazil/gists{/gist_id}","starred_url":"https://api.github.com/users/developer-news-brazil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/developer-news-brazil/subscriptions","organizations_url":"https://api.github.com/users/developer-news-brazil/orgs","repos_url":"https://api.github.com/users/developer-news-brazil/repos","events_url":"https://api.github.com/users/developer-news-brazil/events{/privacy}","received_events_url":"https://api.github.com/users/developer-news-brazil/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/developer-news-brazil/www","description":"","fork":false,"url":"https://api.github.com/repos/developer-news-brazil/www","forks_url":"https://api.github.com/repos/developer-news-brazil/www/forks","keys_url":"https://api.github.com/repos/developer-news-brazil/www/keys{/key_id}","collaborators_url":"https://api.github.com/repos/developer-news-brazil/www/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/developer-news-brazil/www/teams","hooks_url":"https://api.github.com/repos/developer-news-brazil/www/hooks","issue_events_url":"https://api.github.com/repos/developer-news-brazil/www/issues/events{/number}","events_url":"https://api.github.com/repos/developer-news-brazil/www/events","assignees_url":"https://api.github.com/repos/developer-news-brazil/www/assignees{/user}","branches_url":"https://api.github.com/repos/developer-news-brazil/www/branches{/branch}","tags_url":"https://api.github.com/repos/developer-news-brazil/www/tags","blobs_url":"https://api.github.com/repos/developer-news-brazil/www/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/developer-news-brazil/www/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/developer-news-brazil/www/git/refs{/sha}","trees_url":"https://api.github.com/repos/developer-news-brazil/www/git/trees{/sha}","statuses_url":"https://api.github.com/repos/developer-news-brazil/www/statuses/{sha}","languages_url":"https://api.github.com/repos/developer-news-brazil/www/languages","stargazers_url":"https://api.github.com/repos/developer-news-brazil/www/stargazers","contributors_url":"https://api.github.com/repos/developer-news-brazil/www/contributors","subscribers_url":"https://api.github.com/repos/developer-news-brazil/www/subscribers","subscription_url":"https://api.github.com/repos/developer-news-brazil/www/subscription","commits_url":"https://api.github.com/repos/developer-news-brazil/www/commits{/sha}","git_commits_url":"https://api.github.com/repos/developer-news-brazil/www/git/commits{/sha}","comments_url":"https://api.github.com/repos/developer-news-brazil/www/comments{/number}","issue_comment_url":"https://api.github.com/repos/developer-news-brazil/www/issues/comments{/number}","contents_url":"https://api.github.com/repos/developer-news-brazil/www/contents/{+path}","compare_url":"https://api.github.com/repos/developer-news-brazil/www/compare/{base}...{head}","merges_url":"https://api.github.com/repos/developer-news-brazil/www/merges","archive_url":"https://api.github.com/repos/developer-news-brazil/www/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/developer-news-brazil/www/downloads","issues_url":"https://api.github.com/repos/developer-news-brazil/www/issues{/number}","pulls_url":"https://api.github.com/repos/developer-news-brazil/www/pulls{/number}","milestones_url":"https://api.github.com/repos/developer-news-brazil/www/milestones{/number}","notifications_url":"https://api.github.com/repos/developer-news-brazil/www/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/developer-news-brazil/www/labels{/name}","releases_url":"https://api.github.com/repos/developer-news-brazil/www/releases{/id}","deployments_url":"https://api.github.com/repos/developer-news-brazil/www/deployments","created_at":"2016-01-07T17:30:15Z","updated_at":"2016-01-11T17:37:12Z","pushed_at":"2016-01-28T20:00:12Z","git_url":"git://github.com/developer-news-brazil/www.git","ssh_url":"git@github.com:developer-news-brazil/www.git","clone_url":"https://github.com/developer-news-brazil/www.git","svn_url":"https://github.com/developer-news-brazil/www","homepage":null,"size":21,"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/developer-news-brazil/www/pulls/7"},"html":{"href":"https://github.com/developer-news-brazil/www/pull/7"},"issue":{"href":"https://api.github.com/repos/developer-news-brazil/www/issues/7"},"comments":{"href":"https://api.github.com/repos/developer-news-brazil/www/issues/7/comments"},"review_comments":{"href":"https://api.github.com/repos/developer-news-brazil/www/pulls/7/comments"},"review_comment":{"href":"https://api.github.com/repos/developer-news-brazil/www/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/developer-news-brazil/www/pulls/7/commits"},"statuses":{"href":"https://api.github.com/repos/developer-news-brazil/www/statuses/6b205c1d28c26b2de6c2205d9d4dea6fb7679179"}}}}