Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 4 additions & 22 deletions src/modules/user/user.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -671,8 +671,10 @@ export class UserController {
)
data: CreateUserScanEntity,
) {
const hasUser = await this.userRepo.findOne(id).exec();
const event = await this.eventRepo.findOne(eventId).exec();
const [hasUser, event] = await Promise.all([
this.userRepo.findOne(id).exec(),
this.eventRepo.findOne(eventId).exec(),
]);

if (!hasUser) {
throw new HttpException("user not found", HttpStatus.BAD_REQUEST);
Expand Down Expand Up @@ -703,26 +705,6 @@ export class UserController {
e,
);
}

// Send Gotify notification for check-in
try {
const totalScans = await this.scanRepo
.findAll()
.byHackathon(hackathonId)
.resultSize();

const userName = `${hasUser.firstName} ${hasUser.lastName}`;

await this.gotifyService.sendCheckinNotification(
userName,
hasUser.email,
event.name,
totalScans,
);
} catch (error) {
console.log(`Failed to send Gotify check-in notification: ${error}`);
// Don't fail the check-in if notification fails
}
}

@Get(":id/extra-credit/classes")
Expand Down
Loading