Add methods to get challengeMap
Update boot/challenge.js to use new methods Update boot/user.js to use new methods
This commit is contained in:
@ -441,4 +441,28 @@ module.exports = function(User) {
|
||||
}
|
||||
return this.constructor.update$({ id }, updateData, updateOptions);
|
||||
};
|
||||
User.prototype.getPoints$ = function getPoints$() {
|
||||
const id = this.getId();
|
||||
const filter = {
|
||||
where: { id },
|
||||
fields: { progressTimestamps: true }
|
||||
};
|
||||
return this.constructor.findOne$(filter)
|
||||
.map(user => {
|
||||
this.progressTimestamps = user.progressTimestamps;
|
||||
return user.progressTimestamps;
|
||||
});
|
||||
};
|
||||
User.prototype.getChallengeMap$ = function getChallengeMap$() {
|
||||
const id = this.getId();
|
||||
const filter = {
|
||||
where: { id },
|
||||
fields: { challengeMap: true }
|
||||
};
|
||||
return this.constructor.findOne$(filter)
|
||||
.map(user => {
|
||||
this.challengeMap = user.challengeMap;
|
||||
return user.challengeMap;
|
||||
});
|
||||
};
|
||||
};
|
||||
|
Reference in New Issue
Block a user