This commit is contained in:
mattyatea 2024-06-08 18:25:38 +09:00
parent 176e1f9032
commit ff355f5d8b

View file

@ -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,