update
This commit is contained in:
parent
176e1f9032
commit
ff355f5d8b
|
@ -82,8 +82,16 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
this.userProfilesRepository.update({ userId: user.id }, {
|
this.userProfilesRepository.update({ userId: user.id }, {
|
||||||
loggedInDates: [...userProfile.loggedInDates, today],
|
loggedInDates: [...userProfile.loggedInDates, today],
|
||||||
});
|
});
|
||||||
|
const user_ = await this.usersRepository.findOne({
|
||||||
|
where: {
|
||||||
|
id: user.id,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
if (user_ == null) {
|
||||||
|
throw new ApiError(meta.errors.userIsDeleted);
|
||||||
|
}
|
||||||
this.usersRepository.update( user.id, {
|
this.usersRepository.update( user.id, {
|
||||||
getPoints: user.getPoints + todayGetPoints,
|
getPoints: user_.getPoints + todayGetPoints,
|
||||||
});
|
});
|
||||||
this.notificationService.createNotification(user.id, 'loginbonus', {
|
this.notificationService.createNotification(user.id, 'loginbonus', {
|
||||||
loginbonus: todayGetPoints,
|
loginbonus: todayGetPoints,
|
||||||
|
|
Loading…
Reference in a new issue