diff --git a/packages/backend/src/server/api/endpoints/i.ts b/packages/backend/src/server/api/endpoints/i.ts index 2b7a1d30fe..cf8f561e55 100644 --- a/packages/backend/src/server/api/endpoints/i.ts +++ b/packages/backend/src/server/api/endpoints/i.ts @@ -82,10 +82,18 @@ export default class extends Endpoint { // eslint- this.userProfilesRepository.update({ userId: user.id }, { loggedInDates: [...userProfile.loggedInDates, today], }); - this.usersRepository.update( user.id, { - getPoints: user.getPoints + todayGetPoints, + const user_ = await this.usersRepository.findOne({ + where: { + id: user.id, + }, }); - this.notificationService.createNotification(user. id, 'loginbonus', { + if (user_ == null) { + throw new ApiError(meta.errors.userIsDeleted); + } + this.usersRepository.update( user.id, { + getPoints: user_.getPoints + todayGetPoints, + }); + this.notificationService.createNotification(user.id, 'loginbonus', { loginbonus: todayGetPoints, }); userProfile.loggedInDates = [...userProfile.loggedInDates, today];