Created
September 25, 2016 15:49
-
-
Save Technoash/57dcecd8820cd21a4c6b2d8a6a14da4e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module.addUserToDB = function(data){ | |
| return new Promise(function(resolve, reject) { | |
| var userData = { | |
| username: data.profile.name.toLowerCase(), | |
| displayName: data.profile.name, | |
| names: data.names, | |
| id: data.profile.id, | |
| skinHash: data.profile.skinHash, | |
| capes: data.profile.capes, | |
| addedAt: Math.floor(new Date()/1000), | |
| modelType: data.profile.modelType | |
| } | |
| UserModel(userData).save() | |
| .then(function(data){ | |
| resolve(userData); | |
| }) | |
| .catch(function(err){ | |
| reject(Errors.userExists); | |
| }) | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment