From 5adc0da190999b2d5e5955293d82eea6385189a5 Mon Sep 17 00:00:00 2001 From: Nahyan Sharvin Date: Mon, 12 Jan 2026 23:38:17 +0530 Subject: [PATCH 1/2] feat: update participant card compact route to fetch by id --- src/controllers/participantCard.controller.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/controllers/participantCard.controller.js b/src/controllers/participantCard.controller.js index 33e7e68..38ca500 100644 --- a/src/controllers/participantCard.controller.js +++ b/src/controllers/participantCard.controller.js @@ -123,7 +123,7 @@ const getParticipantCards = asyncHandler(async (req, res, next) => { }); const getParticipantCardsCompact = asyncHandler(async (req, res, next) => { - const collegeId = req.user.id; + const collegeId = req.params?.id || req.user?.id; const { users, error } = await fetchParticipansData(collegeId); if (error) { From 5d2848c96253b77de6760e27d1e2051fd2981869 Mon Sep 17 00:00:00 2001 From: Nahyan Sharvin Date: Tue, 13 Jan 2026 00:01:14 +0530 Subject: [PATCH 2/2] feat: update participant card routes to admin routes --- src/controllers/participantCard.controller.js | 6 +++--- src/routes/admin.routes.js | 5 +++++ src/routes/organization.routes.js | 6 +++--- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/controllers/participantCard.controller.js b/src/controllers/participantCard.controller.js index 38ca500..a73bc46 100644 --- a/src/controllers/participantCard.controller.js +++ b/src/controllers/participantCard.controller.js @@ -106,7 +106,7 @@ const fetchAllParticipantsData = async () => { }; const getParticipantCards = asyncHandler(async (req, res, next) => { - const collegeId = req.user.id; + const collegeId = req.params?.id || req.user?.id; const { users, error } = await fetchParticipansData(collegeId); if (error) { @@ -117,7 +117,7 @@ const getParticipantCards = asyncHandler(async (req, res, next) => { res.set({ "Content-Type": "application/pdf", - "Content-Disposition": 'attachment; filename="participant-cards.pdf"', + "Content-Disposition": `attachment; filename="${users[0]?.college}-participant-cards-A6.pdf"`, }); res.send(Buffer.from(pdfBytes)); }); @@ -134,7 +134,7 @@ const getParticipantCardsCompact = asyncHandler(async (req, res, next) => { res.set({ "Content-Type": "application/pdf", - "Content-Disposition": 'attachment; filename="participant-cards-A4.pdf"', + "Content-Disposition": `attachment; filename="${users[0]?.college}-participant-cards.pdf"`, }); res.send(Buffer.from(pdfBytes)); }); diff --git a/src/routes/admin.routes.js b/src/routes/admin.routes.js index 81ea6ab..f053e06 100644 --- a/src/routes/admin.routes.js +++ b/src/routes/admin.routes.js @@ -53,6 +53,11 @@ router.route("/event-registration").get(eventRegistrationController.getAllEventR // PDF export routes router.route("/participants-list/:id").get(pdfExportController.getProgramParticipantsListById); router.route("/all-participant-cards").get(participantCardController.getAllParticipantCardsCompact); +router.route("/participant-cards-compact/:id").get(participantCardController.getParticipantCardsCompact) +router.route("/participant-cards/:id").get(participantCardController.getParticipantCards); +// get participant card by user Id +router.route("/participant-card/:id").get(participantCardController.getParticipantCardById); + router.route("/result-categories").get(eventController.fetchResultCategories); diff --git a/src/routes/organization.routes.js b/src/routes/organization.routes.js index 6d04f84..045ac72 100644 --- a/src/routes/organization.routes.js +++ b/src/routes/organization.routes.js @@ -34,9 +34,9 @@ router.route("/events").get(eventController.fetchAllEvents); // PDF export routes router.route("/participant-tickets").get(pdfExportController.getParticipantTickets); router.route("/ticket/:id").get(pdfExportController.getParticipantTicketById); -router.route("/participant-cards").get(participantCardController.getParticipantCards); -router.route("/participant-card/:id").get(participantCardController.getParticipantCardById); -router.route("/participant-cards-compact").get(participantCardController.getParticipantCardsCompact); +// router.route("/participant-cards").get(participantCardController.getParticipantCards); +// router.route("/participant-card/:id").get(participantCardController.getParticipantCardById); +// router.route("/participant-cards-compact").get(participantCardController.getParticipantCardsCompact); // configs