This commit is contained in:
mattyatea 2024-06-08 18:25:38 +09:00
parent 176e1f9032
commit ff355f5d8b
1 changed files with 11 additions and 3 deletions

View File

@ -82,8 +82,16 @@ 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', {
loginbonus: todayGetPoints,