Skip to content

Instantly share code, notes, and snippets.

@Technoash
Created September 25, 2016 15:49
Show Gist options
  • Select an option

  • Save Technoash/57dcecd8820cd21a4c6b2d8a6a14da4e to your computer and use it in GitHub Desktop.

Select an option

Save Technoash/57dcecd8820cd21a4c6b2d8a6a14da4e to your computer and use it in GitHub Desktop.
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