{"action":"closed","issue":{"url":"https://api.github.com/repos/joshuaslate/mern-starter/issues/15","repository_url":"https://api.github.com/repos/joshuaslate/mern-starter","labels_url":"https://api.github.com/repos/joshuaslate/mern-starter/issues/15/labels{/name}","comments_url":"https://api.github.com/repos/joshuaslate/mern-starter/issues/15/comments","events_url":"https://api.github.com/repos/joshuaslate/mern-starter/issues/15/events","html_url":"https://github.com/joshuaslate/mern-starter/issues/15","id":192371646,"number":15,"title":"remove duplicated role declarations","user":{"login":"jay-at-avido","id":21344963,"avatar_url":"https://avatars.githubusercontent.com/u/21344963?v=3","gravatar_id":"","url":"https://api.github.com/users/jay-at-avido","html_url":"https://github.com/jay-at-avido","followers_url":"https://api.github.com/users/jay-at-avido/followers","following_url":"https://api.github.com/users/jay-at-avido/following{/other_user}","gists_url":"https://api.github.com/users/jay-at-avido/gists{/gist_id}","starred_url":"https://api.github.com/users/jay-at-avido/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jay-at-avido/subscriptions","organizations_url":"https://api.github.com/users/jay-at-avido/orgs","repos_url":"https://api.github.com/users/jay-at-avido/repos","events_url":"https://api.github.com/users/jay-at-avido/events{/privacy}","received_events_url":"https://api.github.com/users/jay-at-avido/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-11-29T19:11:37Z","updated_at":"2016-11-29T19:46:18Z","closed_at":"2016-11-29T19:46:18Z","body":"Currently user role is declared in 2 places, which lends itself to bugs when refactoring code.\r\n\r\nA better solution would be to have a [single source of truth](https://en.wikipedia.org/wiki/Single_source_of_truth) and use variable reference:\r\n\r\n```\r\nconst roles = require('helpers/roles.js')\r\n\r\nconst UserSchema = new Schema({\r\n // [...]\r\n  role: {\r\n    type: String,\r\n    enum: Object.values(roles),\r\n    default: roles.ROLE_MEMBER\r\n  }\r\n```"}}
{"actor":{"display_login":"joshuaslate"}}