Merge pull request #25 from shyim/master

Fixed MySQL User loading
This commit is contained in:
Felix 2016-08-17 00:03:23 +02:00 committed by GitHub
commit 43b10ebdf8
3 changed files with 11 additions and 3 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
.idea
node_modules/

View File

@ -101,8 +101,11 @@ export function createTable(name) {
export function getUserByEmail(email) {
return new Promise((resolve) => {
this.db.instance.query(`SELECT * FROM ${CFG.SERVER_MYSQL_TABLE} WHERE email=? LIMIT 1`, [email], (e, rows, fields) => {
if (e) console.log(e);
else resolve(rows);
if (e) {
console.log(e);
} else {
resolve(rows[0]);
}
});
});
}

View File

@ -77,7 +77,11 @@ class Player {
updateByObject(obj) {
for (let key in obj) {
if (this.hasOwnProperty(key)) {
this[key] = obj[key];
if (key === "send_marketing_emails" || key === "send_push_notifications") {
this[key] = !!obj[key];
} else {
this[key] = obj[key];
}
}
};
}