diff --git a/src/services/attendee/attendee-router.ts b/src/services/attendee/attendee-router.ts index 42ad60d..41d827e 100644 --- a/src/services/attendee/attendee-router.ts +++ b/src/services/attendee/attendee-router.ts @@ -130,6 +130,30 @@ attendeeRouter.get( } ); +attendeeRouter.get( + "/points", + RoleChecker([Role.Enum.USER]), + async (req, res, next) => { + try { + const payload = res.locals.payload; + const userId = payload.userId; + + // Check if the user exists in the database + const user = await Database.ATTENDEE.findOne({ userId }); + + if (!user) { + return res + .status(StatusCodes.NOT_FOUND) + .json({ error: "UserNotFound" }); + } + + return res.status(StatusCodes.OK).json({ points: user.points }); + } catch (error) { + next(error); + } + } +); + attendeeRouter.get( "/", RoleChecker([Role.Enum.USER]),