{"action":"closed","issue":{"url":"https://api.github.com/repos/IMA-WorldHealth/bhima-2.X/issues/287","repository_url":"https://api.github.com/repos/IMA-WorldHealth/bhima-2.X","labels_url":"https://api.github.com/repos/IMA-WorldHealth/bhima-2.X/issues/287/labels{/name}","comments_url":"https://api.github.com/repos/IMA-WorldHealth/bhima-2.X/issues/287/comments","events_url":"https://api.github.com/repos/IMA-WorldHealth/bhima-2.X/issues/287/events","html_url":"https://github.com/IMA-WorldHealth/bhima-2.X/issues/287","id":146860870,"number":287,"title":"Re-factor server controllers/database","user":{"login":"sfount","id":2844572,"avatar_url":"https://avatars.githubusercontent.com/u/2844572?v=3","gravatar_id":"","url":"https://api.github.com/users/sfount","html_url":"https://github.com/sfount","followers_url":"https://api.github.com/users/sfount/followers","following_url":"https://api.github.com/users/sfount/following{/other_user}","gists_url":"https://api.github.com/users/sfount/gists{/gist_id}","starred_url":"https://api.github.com/users/sfount/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sfount/subscriptions","organizations_url":"https://api.github.com/users/sfount/orgs","repos_url":"https://api.github.com/users/sfount/repos","events_url":"https://api.github.com/users/sfount/events{/privacy}","received_events_url":"https://api.github.com/users/sfount/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/IMA-WorldHealth/bhima-2.X/labels/refactor","name":"refactor","color":"fbca04"}],"state":"closed","locked":false,"assignee":{"login":"lomamech","id":8035588,"avatar_url":"https://avatars.githubusercontent.com/u/8035588?v=3","gravatar_id":"","url":"https://api.github.com/users/lomamech","html_url":"https://github.com/lomamech","followers_url":"https://api.github.com/users/lomamech/followers","following_url":"https://api.github.com/users/lomamech/following{/other_user}","gists_url":"https://api.github.com/users/lomamech/gists{/gist_id}","starred_url":"https://api.github.com/users/lomamech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lomamech/subscriptions","organizations_url":"https://api.github.com/users/lomamech/orgs","repos_url":"https://api.github.com/users/lomamech/repos","events_url":"https://api.github.com/users/lomamech/events{/privacy}","received_events_url":"https://api.github.com/users/lomamech/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/IMA-WorldHealth/bhima-2.X/milestones/1","html_url":"https://github.com/IMA-WorldHealth/bhima-2.X/milestones/2.x%20Process","labels_url":"https://api.github.com/repos/IMA-WorldHealth/bhima-2.X/milestones/1/labels","id":1661435,"number":1,"title":"2.x Process","description":"Any design or code referenced by the 2.x completion review process.","creator":{"login":"sfount","id":2844572,"avatar_url":"https://avatars.githubusercontent.com/u/2844572?v=3","gravatar_id":"","url":"https://api.github.com/users/sfount","html_url":"https://github.com/sfount","followers_url":"https://api.github.com/users/sfount/followers","following_url":"https://api.github.com/users/sfount/following{/other_user}","gists_url":"https://api.github.com/users/sfount/gists{/gist_id}","starred_url":"https://api.github.com/users/sfount/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sfount/subscriptions","organizations_url":"https://api.github.com/users/sfount/orgs","repos_url":"https://api.github.com/users/sfount/repos","events_url":"https://api.github.com/users/sfount/events{/privacy}","received_events_url":"https://api.github.com/users/sfount/received_events","type":"User","site_admin":false},"open_issues":28,"closed_issues":53,"state":"open","created_at":"2016-03-23T07:38:02Z","updated_at":"2016-04-28T09:45:36Z","due_on":"2016-04-23T23:00:00Z","closed_at":null},"comments":2,"created_at":"2016-04-08T08:40:24Z","updated_at":"2016-04-28T09:45:36Z","closed_at":"2016-04-28T09:45:36Z","body":"Each of these re-factor tasks will improve the strength/ ease of maintenance on the server/ database. They are all very important to build the 2.x core structures. \r\n\r\n* Remove all redundant tables that are not used in 2.x\r\n* Ensure all foreign key links reference the correct tables\r\n* List all of the files that currently still use req.codes for error handling (GitHub Issue?)\r\n* Replace req.codes with imported errors (require /lib/errors)\r\n\r\n**Replace**\r\n```js\r\nthrow new req.codes.ERR_NOT_FOUND() //...\r\n```\r\n**With:**\r\n```js\r\nvar NotFound = require('lib/errors/NotFound');\r\n// ...\r\nthrow new NotFound('Resource not found');\r\n```\r\n* Ensure all error codes in /lib/errors have the same attributes and structure \r\n\r\nThis could be submitted as one re-factor or a number of pull requests. "}}