diff --git a/src/controllers/participantCard.controller.js b/src/controllers/participantCard.controller.js index 33e7e68..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,13 +117,13 @@ 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)); }); 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) { @@ -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