{"action":"created","issue":{"url":"https://api.github.com/repos/freecodecamp-london/yak/issues/11","repository_url":"https://api.github.com/repos/freecodecamp-london/yak","labels_url":"https://api.github.com/repos/freecodecamp-london/yak/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/freecodecamp-london/yak/issues/11/comments","events_url":"https://api.github.com/repos/freecodecamp-london/yak/issues/11/events","html_url":"https://github.com/freecodecamp-london/yak/issues/11","id":139985801,"number":11,"title":"User Model","user":{"login":"natac13","id":10660283,"avatar_url":"https://avatars.githubusercontent.com/u/10660283?v=3","gravatar_id":"","url":"https://api.github.com/users/natac13","html_url":"https://github.com/natac13","followers_url":"https://api.github.com/users/natac13/followers","following_url":"https://api.github.com/users/natac13/following{/other_user}","gists_url":"https://api.github.com/users/natac13/gists{/gist_id}","starred_url":"https://api.github.com/users/natac13/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/natac13/subscriptions","organizations_url":"https://api.github.com/users/natac13/orgs","repos_url":"https://api.github.com/users/natac13/repos","events_url":"https://api.github.com/users/natac13/events{/privacy}","received_events_url":"https://api.github.com/users/natac13/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/freecodecamp-london/yak/labels/needs-discussion","name":"needs-discussion","color":"0052cc"}],"state":"open","locked":false,"assignee":{"login":"natac13","id":10660283,"avatar_url":"https://avatars.githubusercontent.com/u/10660283?v=3","gravatar_id":"","url":"https://api.github.com/users/natac13","html_url":"https://github.com/natac13","followers_url":"https://api.github.com/users/natac13/followers","following_url":"https://api.github.com/users/natac13/following{/other_user}","gists_url":"https://api.github.com/users/natac13/gists{/gist_id}","starred_url":"https://api.github.com/users/natac13/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/natac13/subscriptions","organizations_url":"https://api.github.com/users/natac13/orgs","repos_url":"https://api.github.com/users/natac13/repos","events_url":"https://api.github.com/users/natac13/events{/privacy}","received_events_url":"https://api.github.com/users/natac13/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/freecodecamp-london/yak/milestones/1","html_url":"https://github.com/freecodecamp-london/yak/milestones/1.0.0","labels_url":"https://api.github.com/repos/freecodecamp-london/yak/milestones/1/labels","id":1636415,"number":1,"title":"1.0.0","description":"Issues related to first major milestone.","creator":{"login":"j-klassen","id":1383068,"avatar_url":"https://avatars.githubusercontent.com/u/1383068?v=3","gravatar_id":"","url":"https://api.github.com/users/j-klassen","html_url":"https://github.com/j-klassen","followers_url":"https://api.github.com/users/j-klassen/followers","following_url":"https://api.github.com/users/j-klassen/following{/other_user}","gists_url":"https://api.github.com/users/j-klassen/gists{/gist_id}","starred_url":"https://api.github.com/users/j-klassen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/j-klassen/subscriptions","organizations_url":"https://api.github.com/users/j-klassen/orgs","repos_url":"https://api.github.com/users/j-klassen/repos","events_url":"https://api.github.com/users/j-klassen/events{/privacy}","received_events_url":"https://api.github.com/users/j-klassen/received_events","type":"User","site_admin":false},"open_issues":9,"closed_issues":0,"state":"open","created_at":"2016-03-10T12:17:34Z","updated_at":"2016-03-11T13:06:30Z","due_on":null,"closed_at":null},"comments":8,"created_at":"2016-03-10T19:27:38Z","updated_at":"2016-03-14T12:19:07Z","closed_at":null,"body":"### Structure\r\nUses the custom SchemaType [Email](https://github.com/freecodecamp-london/yak-server/issues/9)\r\n```js\r\n// creates the createdAt and updatedAT fileds so I don't have to. \r\nconst options = { timestamps: true };\r\nconst re = /^([A-Z|a-z|0-9](\\.|_){0,1})+[A-Z|a-z|0-9]\\@([A-Z|a-z|0-9])+((\\.){0,1}[A-Z|a-z|0-9]){2}\\.[a-z]{2,3}$/;\r\n\r\n ##const User = Schema({\r\n  name: {\r\n    first: {\r\n      type: String,\r\n      required: true\r\n    },\r\n    last: {\r\n      type: String,\r\n      required: true\r\n    },       \r\n   },\r\n   username: {\r\n      type: String,\r\n      unique: true,\r\n      required: true\r\n    },\r\n    avatar: { type: String, match: /urlRegex/},\r\n    email: { \r\n      type: String, \r\n      match: re,\r\n      required: true,\r\n      unique: true\r\n   },\r\n   contacts: { type: Schema.Types.ObjectId, ref: 'Contacts' },\r\n   blocked: { type: Schema.Types.ObjectId, ref: 'Blocked' },\r\n   channels: { type: Schema.Types.ObjectId, ref: 'Channel' }, \r\n   password: String,\r\n   social: {}\r\n}, options);\r\n\r\nUser.virtual('name.full').get(function () { `${this.name.first} ${this.name.last}`; }\r\nUser.virtual('name.full').set(function(value) {\r\n  const [ first, last ] = name.split(' ');\r\n  this.name.first = first;\r\n  this.name.last = last;\r\n}\r\n```\r\n**Discussion Needed**\r\nInstead of adding each of the social media sites the option for `strict` to false. This would allow the social media fields not already on the model to be created. This can also be done at the instance level which ~~could be a **better** idea. This would *only* happen to the User instance inside of the app route that handles logging in.~~ However there is a note saying to not set this to false unless I have good reason. "},"comment":{"url":"https://api.github.com/repos/freecodecamp-london/yak/issues/comments/196287168","html_url":"https://github.com/freecodecamp-london/yak/issues/11#issuecomment-196287168","issue_url":"https://api.github.com/repos/freecodecamp-london/yak/issues/11","id":196287168,"user":{"login":"natac13","id":10660283,"avatar_url":"https://avatars.githubusercontent.com/u/10660283?v=3","gravatar_id":"","url":"https://api.github.com/users/natac13","html_url":"https://github.com/natac13","followers_url":"https://api.github.com/users/natac13/followers","following_url":"https://api.github.com/users/natac13/following{/other_user}","gists_url":"https://api.github.com/users/natac13/gists{/gist_id}","starred_url":"https://api.github.com/users/natac13/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/natac13/subscriptions","organizations_url":"https://api.github.com/users/natac13/orgs","repos_url":"https://api.github.com/users/natac13/repos","events_url":"https://api.github.com/users/natac13/events{/privacy}","received_events_url":"https://api.github.com/users/natac13/received_events","type":"User","site_admin":false},"created_at":"2016-03-14T12:19:07Z","updated_at":"2016-03-14T12:19:07Z","body":"Would it be better to have a pre save hook to set a default avatar or just set it as a default in the Schema itself. \r\n\r\nAlso was thinking we could have a regex check on the password to contain a uppercase, lowercase, number and special character, such as more passwords need now. "}}