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

View file

@ -82,10 +82,18 @@ 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],
}); });
this.usersRepository.update( user.id, { const user_ = await this.usersRepository.findOne({
getPoints: user.getPoints + todayGetPoints, 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, loginbonus: todayGetPoints,
}); });
userProfile.loggedInDates = [...userProfile.loggedInDates, today]; userProfile.loggedInDates = [...userProfile.loggedInDates, today];