Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
mattyatea committed Jun 8, 2024
1 parent 176e1f9 commit ff355f5
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/backend/src/server/api/endpoints/i.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,18 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
this.userProfilesRepository.update({ userId: user.id }, {
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, {
getPoints: user.getPoints + todayGetPoints,
getPoints: user_.getPoints + todayGetPoints,
});
this.notificationService.createNotification(user. id, 'loginbonus', {
this.notificationService.createNotification(user.id, 'loginbonus', {
loginbonus: todayGetPoints,
});
userProfile.loggedInDates = [...userProfile.loggedInDates, today];
Expand Down

0 comments on commit ff355f5

Please sign in to comment.