- This is an automated confirmation email. Please do not reply directly to this message.
-
-
-
-
-
- `;
-};
-
-export const sendmail = async (name, email, query) => {
- try {
- const transporter = nodemailer.createTransport({
- host: "smtp.zoho.in",
- port: 465,
- secure: true,
- auth: {
- user: process.env.SENDER_EMAIL,
- pass: process.env.SENDER_PASS
- }
- });
-
- // Enhanced mail options for the team
- const teamMailOptions = {
- from: process.env.SENDER_EMAIL,
- to: process.env.RECIPIENT_EMAIL,
- replyTo: email, // Enable direct reply to the sender
- subject: `🔔 New Contact Form Submission from ${name}`,
- html: createEmailTemplate(name, email, query),
- // Add plain text version for better compatibility
- text: `
-New Contact Form Submission
-
-From: ${name} (${email})
-Date: ${new Date().toLocaleString('en-US', { timeZone: 'Asia/Kolkata' })} IST
-
-Message:
-${query}
-
-Reply to this person: ${email}
- `
- };
-
- // Confirmation email for the sender
- const confirmationMailOptions = {
- from: process.env.SENDER_EMAIL,
- to: email,
- subject: "✅ Thank you for contacting GitHub Community SRM",
- html: createConfirmationTemplate(name),
- text: `
-Hi ${name}!
-
-Thank you for reaching out to GitHub Community SRM! We've received your message and our team will get back to you within 24-48 hours.
-
-What happens next?
-Our team will review your message and respond with relevant information, resources, or next steps.
-
-Best regards,
-GitHub Community SRM Team
- `
- };
-
- // Send both emails
- const [teamEmailResult, confirmationResult] = await Promise.all([
- transporter.sendMail(teamMailOptions),
- transporter.sendMail(confirmationMailOptions)
- ]);
-
- console.log("Team email sent successfully:", teamEmailResult.response);
- console.log("Confirmation email sent successfully:", confirmationResult.response);
-
- return {
- success: true,
- message: "Emails sent successfully",
- details: {
- teamEmail: teamEmailResult.messageId,
- confirmationEmail: confirmationResult.messageId
- }
- };
- } catch (err) {
- console.error("Error sending emails:", err.message);
- return {
- success: false,
- message: `Failed to send email: ${err.message}`
- };
- }
-};
\ No newline at end of file
diff --git a/pages/api/v1/events/index.js b/pages/api/v1/events/index.js
deleted file mode 100644
index d0b6590..0000000
--- a/pages/api/v1/events/index.js
+++ /dev/null
@@ -1,21 +0,0 @@
-import Event from "@/utils/models/event.models";
-import DBInstance from "@/utils/db";
-DBInstance();
-
-export default async function handler(req, res) {
- if (req.method === "GET") {
- try {
- // Retrieve all events from the database
- const events = await Event.find();
-
- // Send the response with the retrieved events
- res.status(200).json({ success: true, data: events });
- } catch (error) {
- console.error(error);
- res.status(500).json({ success: false, error: "Internal Server Error" });
- }
- } else {
- // Handle unsupported HTTP methods
- res.status(405).json({ success: false, error: "Method Not Allowed" });
- }
-}
\ No newline at end of file
diff --git a/pages/api/v1/events/register/index.js b/pages/api/v1/events/register/index.js
deleted file mode 100644
index bf736be..0000000
--- a/pages/api/v1/events/register/index.js
+++ /dev/null
@@ -1,80 +0,0 @@
-import DBInstance from "@/utils/db";
-import Event from "@/utils/models/event.models";
-import mongoose from "mongoose";
-import { sendRegistrationEmail } from "@/utils/email/registration";
-
-DBInstance();
-
-export default async function handler(req, res) {
- if (req.method === "POST") {
- const { name, regNo, email, phn, dept, slug } = req.body;
-
- if (!name || !regNo || !email || !phn || !dept || !slug) {
- return res
- .status(400)
- .json({ success: false, error: "All fields are required." });
- }
-
- try {
- const event = await Event.findOne({ slug });
-
- if (!event) {
- return res
- .status(404)
- .json({ success: false, error: "Event not found." });
- }
-
- const { database, collection } = event;
- const participantsCollection = collection.participants;
- const db = mongoose.connection.useDb(database);
- const participantSchema = new mongoose.Schema({
- name: { type: String, required: true },
- regNo: { type: String, required: true },
- email: { type: String, required: true },
- phn: { type: String, required: true },
- dept: { type: String, required: true },
- rsvp: { type: Boolean, default: false },
- checkin: { type: Boolean, default: false },
- snacks: { type: Boolean, default: false }
- });
-
- const Participant = db.model(
- participantsCollection,
- participantSchema
- );
-
- const existingParticipant = await Participant.findOne({ email: { $eq: email } });
-
- if (existingParticipant) {
- return res.status(400).json({
- success: false,
- error: "Email already registered for this event."
- });
- }
-
- const newParticipant = new Participant({
- name,
- regNo,
- email,
- phn,
- dept
- });
-
- await newParticipant.save();
- await sendRegistrationEmail(newParticipant, event);
-
- res.status(200).json({
- success: true,
- message: "Participant registered successfully."
- });
- } catch (error) {
- console.error(error);
- res.status(500).json({
- success: false,
- error: "Internal Server Error"
- });
- }
- } else {
- res.status(405).json({ success: false, error: "Method Not Allowed" });
- }
-}
diff --git a/pages/api/v1/healthcheck.js b/pages/api/v1/healthcheck.js
deleted file mode 100644
index 118138c..0000000
--- a/pages/api/v1/healthcheck.js
+++ /dev/null
@@ -1,44 +0,0 @@
-import os from "os";
-import DBInstance from "@/utils/db";
-
-const formatTime = (seconds) => {
- function pad(s) {
- return (s < 10 ? "0" : "") + s;
- }
- let hours = Math.floor(seconds / (60 * 60));
- let minutes = Math.floor((seconds % (60 * 60)) / 60);
- let secs = Math.floor(seconds % 60);
-
- return pad(hours) + ":" + pad(minutes) + ":" + pad(secs);
-};
-
-export default async function handler(req, res) {
- let healthcheckData = {
- message: "🛠️ API v1 working!",
- timestamp: new Date().toUTCString(),
- cpus: os.cpus(),
- architecture: os.arch(),
- networkInterfaces: os.networkInterfaces(),
- totalMemory: os.totalmem(),
- freeMemory: os.freemem(),
- platform: os.platform(),
- osType: os.type(),
- osRelease: os.release(),
- osVersion: os.version(),
- hostname: os.hostname(),
- userInfo: os.userInfo(),
- serverUptime: formatTime(process.uptime()),
- osUptime: formatTime(os.uptime()),
- reqIP: req.headers["x-real-ip"] || req.connection.remoteAddress
- };
-
- try {
- await DBInstance();
- healthcheckData.mongoDBStatus = "✅ Connected to MongoDB";
- } catch (error) {
- console.error("❌ Could not connect to MongoDB\n", error.message);
- healthcheckData.mongoDBStatus = "❌ MongoDB connection failed";
- }
-
- res.status(200).json({ status: true, message: healthcheckData });
-}
diff --git a/pages/api/v1/recruitment/index.js b/pages/api/v1/recruitment/index.js
deleted file mode 100644
index 5f1cb27..0000000
--- a/pages/api/v1/recruitment/index.js
+++ /dev/null
@@ -1,92 +0,0 @@
-import DBInstance from "@/utils/db";
-import Participant from "@/utils/models/recruitment.model.js";
-
-DBInstance();
-
-export default async function handler(req, res) {
- if (req.method === "POST") {
- const {
- name,
- registrationNo,
- email,
- phone,
- branch,
- year,
- position,
- subDomain1,
- subDomain2
- } = req.body;
-
- // Validate required fields
- if (
- !name ||
- !registrationNo ||
- !email ||
- !phone ||
- !branch ||
- !year ||
- !position
- ) {
- return res
- .status(400)
- .json({ success: false, error: "All fields are required." });
- }
-
- try {
- // Check if the participant already exists based on email or registration number
- const existingParticipant = await Participant.findOne({
- $or: [{ email }, { regNo: registrationNo }]
- });
-
- if (existingParticipant) {
- return res.status(401).json({
- success: false,
- error: "Email or Registration Number already registered."
- });
- }
-
- // Structure the domain object based on the position and subdomains
- const domain = {
- [position]: [subDomain1]
- };
-
- if (subDomain2) {
- domain[position].push(subDomain2); // Add subDomain2 only if provided
- }
-
- // Create a new participant
- const newParticipant = new Participant({
- name,
- regNo: registrationNo,
- email,
- phoneNo: phone,
- dept: branch,
- year,
- domain,
- status: "registered"
- });
-
- // Save the new participant to the database
- await newParticipant.save();
-
- // Respond with success and the new participant data
- return res.status(201).json({
- success: true,
- data: newParticipant
- });
- } catch (error) {
- // Handle any errors that occur during the process
- console.error("Error during registration:", error);
- return res.status(500).json({
- success: false,
- error: "Internal Server Error"
- });
- }
- } else {
- // Handle non-POST requests
- return res.status(405).json({
- success: false,
- error: "Method Not Allowed"
- });
- }
-}
diff --git a/pages/api/v1/recruitment/task/index.js b/pages/api/v1/recruitment/task/index.js
deleted file mode 100644
index 8377fdc..0000000
--- a/pages/api/v1/recruitment/task/index.js
+++ /dev/null
@@ -1,99 +0,0 @@
-import DBInstance from "@/utils/db";
-import ParticipantUser from "@/utils/models/recruitment.model";
-import Task from "@/utils/models/tasks.model";
-
-DBInstance();
-
-// Utility function to clean up the reference link and any other fields if necessary
-const cleanTaskData = (task) => {
- // Ensure the reference-link is cleaned from any extra quotes and whitespace
- if (task["link"]) {
- task["link"] = task["link"].replace(/^\s*"+|"+\s*$/g, ''); // Remove leading/trailing quotes and whitespace
- }
- return task;
-};
-
-export default async function handler(req, res) {
- const { method } = req;
-
- if (method === "GET") {
- try {
- const { email } = req.query;
-
- if (!email) {
- return res.status(400).json({ message: "Email is required" });
- }
-
- const participant = await ParticipantUser.findOne({ email });
- if (!participant) {
- return res.status(404).json({ message: "Participant not found" });
- }
-
- // Extract participant details
- const { name, regNo, email: participantEmail, phoneNo, year, dept, domain, status } = participant;
- let taskQueries = [];
- let subdomainsList = [];
-
- // Extract the domain keys only
- const domainKeys = Array.from(domain.keys())[0]; // Take the first key
-
- // Handle different domains (Technical, Creatives, Corporate, etc.)
- for (let [domainKey, subdomains] of domain.entries()) {
- if (domainKey === "Corporate") {
- taskQueries.push({ domain: domainKey, year: year });
- } else {
- if (subdomains && subdomains.length > 0) {
- taskQueries.push({
- domain: domainKey,
- subdomain: { $in: subdomains },
- year: year
- });
- subdomainsList = subdomainsList.concat(subdomains);
- }
- }
- }
-
- if (taskQueries.length === 0) {
- return res.status(200).json({
- name,
- regNo,
- email: participantEmail,
- year,
- dept,
- phoneNo,
- domain: domainKeys, // Return only the domain keys
- subdomains: subdomainsList,
- status,
- tasks: []
- });
- }
-
- // Fetch tasks based on the query
- let tasks = await Task.find({
- $or: taskQueries
- });
-
- // Clean each task before sending it to the client
- tasks = tasks.map(cleanTaskData);
-
- return res.status(200).json({
- name,
- regNo,
- email: participantEmail,
- year,
- dept,
- phoneNo,
- domain: domainKeys, // Return only the domain keys
- subdomains: subdomainsList,
- status,
- tasks // This will include the reference link along with other task details
- });
- } catch (error) {
- console.error("Error fetching participant data:", error);
- return res.status(500).json({ message: "Internal server error" });
- }
- } else {
- res.setHeader("Allow", ["GET"]);
- return res.status(405).end(`Method ${method} Not Allowed`);
- }
-}
\ No newline at end of file
diff --git a/pages/api/v1/sponsers/index.js b/pages/api/v1/sponsers/index.js
deleted file mode 100644
index a999a90..0000000
--- a/pages/api/v1/sponsers/index.js
+++ /dev/null
@@ -1,23 +0,0 @@
-import DBInstance from "@/utils/db";
-import Sponsor from "@/utils/models/sponser.model";
-DBInstance();
-
-export default async function handler(req, res) {
- if (req.method === "GET") {
- try {
- const sponsers = await Sponsor.find();
- console.log("hello2s")
- res.status(200).json({ success: true, data: sponsers });
- } catch (error) {
- console.error(error);
- res.status(500).json({ success: false, error: "Internal Server Error" });
- }
- } else {
- console.log("🚫", req.method, "was called and got an error!");
- res.status(405).json({
- success: false,
- data: null,
- message: "🚫 HTTP Method not Allowed"
- });
- }
-}
diff --git a/pages/api/v1/team/index.js b/pages/api/v1/team/index.js
deleted file mode 100644
index 49bc841..0000000
--- a/pages/api/v1/team/index.js
+++ /dev/null
@@ -1,26 +0,0 @@
-import Team from "@/utils/models/team.model";
-import DBInstance from "@/utils/db";
-DBInstance();
-
-export default async function handler(req, res) {
- if (req.method === "GET") {
- try {
- // Retrieve all current team members from the database and sort by index
- const team = await Team.find({ isCurrent: true }).sort({
- index: 1
- });
-
- // Send the response with the retrieved team members
- res.status(200).json({ success: true, data: team });
- } catch (error) {
- console.error(error);
- res.status(500).json({
- success: false,
- error: "Internal Server Error"
- });
- }
- } else {
- // Handle unsupported HTTP methods
- res.status(405).json({ success: false, error: "Method Not Allowed" });
- }
-}
diff --git a/public/sitemap-0.xml b/public/sitemap-0.xml
index b7dadf0..265a92b 100644
--- a/public/sitemap-0.xml
+++ b/public/sitemap-0.xml
@@ -1,8 +1,8 @@
-https://githubsrmist.in2025-10-18T07:30:38.900Zdaily0.7
-https://githubsrmist.in/about2025-10-18T07:30:38.901Zdaily0.7
-https://githubsrmist.in/contact2025-10-18T07:30:38.901Zdaily0.7
-https://githubsrmist.in/events2025-10-18T07:30:38.901Zdaily0.7
-https://githubsrmist.in/team2025-10-18T07:30:38.901Zdaily0.7
+https://githubsrmist.in2025-12-02T08:58:50.626Zdaily0.7
+https://githubsrmist.in/about2025-12-02T08:58:50.627Zdaily0.7
+https://githubsrmist.in/contact2025-12-02T08:58:50.627Zdaily0.7
+https://githubsrmist.in/events2025-12-02T08:58:50.627Zdaily0.7
+https://githubsrmist.in/team2025-12-02T08:58:50.627Zdaily0.7
\ No newline at end of file
diff --git a/utils/certificates/jimpOverlay.js b/utils/certificates/jimpOverlay.js
deleted file mode 100644
index 1860409..0000000
--- a/utils/certificates/jimpOverlay.js
+++ /dev/null
@@ -1,66 +0,0 @@
-import Jimp from "jimp-compact";
-
-const textOverlay = async (
- name,
- url,
- color,
- font_size,
- yOffset,
- jimpOptions
-) => {
- // console.log("textOverlay function called");
-
- try {
- // console.log("Received color:", color);
- // console.log("Received font_size:", font_size);
- // console.log("Received yOffset:", yOffset);
-
- if (!color || !font_size || !yOffset) {
- return {
- buffer: null,
- error: true,
- error_message: "Missing required image config values."
- };
- }
-
- const fontKey = `FONT_${font_size}_${color.toUpperCase()}`;
- // console.log("Constructed fontKey:", fontKey);
-
- if (!jimpOptions[fontKey]) {
- return {
- buffer: null,
- error: true,
- error_message: `Invalid font combination: ${fontKey}`
- };
- }
-
- const font = await Jimp.loadFont(jimpOptions[fontKey]);
- const image = await Jimp.read(url);
- image.scaleToFit(1300, Jimp.AUTO, Jimp.RESIZE_BEZIER);
-
- image.print(
- font,
- 0,
- parseInt(yOffset),
- {
- text: name,
- alignmentX: Jimp.HORIZONTAL_ALIGN_CENTER,
- alignmentY: Jimp.VERTICAL_ALIGN_MIDDLE
- },
- 1300,
- 900
- );
-
- const bufferImage = await image.getBase64Async(Jimp.MIME_PNG);
- return { buffer: bufferImage, error: false, error_message: "Success" };
- } catch (error) {
- // console.log("Error in textOverlay:", error.message);
- return {
- buffer: null,
- error: true,
- error_message: error.message || "Failed"
- };
- }
-};
-
-export default textOverlay;
diff --git a/utils/config.js b/utils/config.js
index e0667e0..5185838 100644
--- a/utils/config.js
+++ b/utils/config.js
@@ -13,7 +13,9 @@ export const API_ENDPOINTS = {
},
EVENTS: {
GET_ALL: `${API_BASE_URL}/api/events`, // GET - Retrieve all events
- GET_BY_ID: (id) => `${API_BASE_URL}/api/event/${id}`, // GET - Retrieve a single event by ID
+ GET_BY_ID: (id) => `${API_BASE_URL}/api/events/${id}`, // GET - Retrieve a single event by ID
+ GET_BY_SLUG: (slug) => `${API_BASE_URL}/api/events/slug/${slug}`, // GET - Retrieve a single event by slug
+ REGISTER: `${API_BASE_URL}/api/events/register`, // POST - Register for an event
},
SPONSORS: {
GET_ALL: `${API_BASE_URL}/api/sponsors`, // GET - Retrieve all sponsors
@@ -23,8 +25,7 @@ export const API_ENDPOINTS = {
},
CERTIFICATES: {
GENERATE: `${API_BASE_URL}/api/certificate/generate`, // POST - Generate a certificate for an event participant
- VERIFY: (certificateId) => `${API_BASE_URL}/api/certificate/verify/${certificateId}`, // GET - Verify the authenticity of a certificate
- DOWNLOAD: (certificateId) => `${API_BASE_URL}/api/certificate/download/${certificateId}`, // GET - Download a verified certificate
+ DOWNLOAD: (certificateId) => `${API_BASE_URL}/api/certificate/download/${certificateId}?format=pdf`, // GET - Download a verified certificate (External)
},
};
export const API_CONFIG = {
diff --git a/utils/db/index.js b/utils/db/index.js
deleted file mode 100644
index 6054ca9..0000000
--- a/utils/db/index.js
+++ /dev/null
@@ -1,23 +0,0 @@
-import mongoose from "mongoose";
-import dotenv from "dotenv";
-
-dotenv.config();
-
-const { MONGO_URI, DB_NAME } = process.env;
-
-const DBInstance = async () => {
- try {
- await mongoose.connect(MONGO_URI, {
- useNewUrlParser: true,
- useUnifiedTopology: true,
- dbName: DB_NAME
- });
-
- // console.log(`✅ Connected to MongoDB: ${NEXT_PUBLIC_DB_NAME}`);
- } catch (err) {
- // console.error("❌ Could not connect to MongoDB\n", err.message);
- throw err;
- }
-};
-
-export default DBInstance;
diff --git a/utils/email/registration.js b/utils/email/registration.js
deleted file mode 100644
index f0fb183..0000000
--- a/utils/email/registration.js
+++ /dev/null
@@ -1,64 +0,0 @@
-import { SESClient, SendEmailCommand } from "@aws-sdk/client-ses";
-import fs from "fs";
-import path from "path";
-import dotenv from "dotenv";
-dotenv.config();
-
-const sesClient = new SESClient({
- region: process.env.AWS_REGION,
- credentials: {
- accessKeyId: process.env.AWS_ACCESS_KEY_ID,
- secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY
- }
-});
-
-export async function sendRegistrationEmail(participant, event) {
- try {
- const filePath = path.resolve(
- process.cwd(),
- "utils/email/registrationMail.html"
- );
-
- const emailContent = fs.readFileSync(filePath, "utf8");
-
- const customizedContent = emailContent
- .replaceAll("{{name}}", participant.name)
- .replaceAll("{{email}}", participant.email)
- .replaceAll("{{phn}}", participant.phn)
- .replaceAll("{{event}}", event.event_name)
- .replaceAll("{{department}}", participant.dept)
- .replaceAll("{{registrationNumber}}", participant.regNo)
- .replaceAll("{{event_description}}", event.event_description)
- .replaceAll("{{date}}", event.event_date)
- // .replaceAll("{{time}}", event.event_time)
- .replaceAll("{{venue}}", event.venue)
- .replaceAll("{{prerequisites}}", event.prerequisites)
- .replaceAll("{{event_banner}}", event.poster_url);
-
- const params = {
- Destination: {
- ToAddresses: [participant.email]
- },
- Message: {
- Body: {
- Html: {
- Charset: "UTF-8",
- Data: customizedContent
- }
- },
- Subject: {
- Charset: "UTF-8",
- Data: `Registration Confirmation for ${event.event_name}`
- }
- },
- Source: `"GitHub Community SRM | Events" `,
- ReplyToAddresses: ["community@githubsrmist.in"]
- };
-
- const command = new SendEmailCommand(params);
- await sesClient.send(command);
- console.log("Registration email sent successfully.");
- } catch (error) {
- console.error("Error sending email:", error);
- }
-}
diff --git a/utils/email/registrationMail.html b/utils/email/registrationMail.html
deleted file mode 100644
index 4ac9ba5..0000000
--- a/utils/email/registrationMail.html
+++ /dev/null
@@ -1,1365 +0,0 @@
-
-
-
-
-
-
-
-
- Empty template
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Registration
- Confirmation
-
-
-
- Registration
- Confirmation
-
-
-
- Dear
- {{name}},
-
-
-
- Thank
- you
- for
- registering
- for
- the
- event
- "{{event}}",
- hosted
- by
- GitHub
- Community
- SRM.
- Your
- registration
- is
- confirmed!
-
-
-
- Event
- Details:
-
-
-
-
- Event
- Name:
-
- {{event}}
-
-
- Event
- Description:
- {{event_description}}
-
-
- Date/Time:
- {{date}}
-
-
-
- Venue:
- {{venue}}
-
-
- Prerequisites:
- {{prerequisites}}
-
-
-
- Be
- sure
- to
- bring
- your
- laptop,
- charger,
- and
- any
- other
- necessary
- items
- to
- fully
- participate
- in
- the
- event.
-
-
-
- We
- are
- excited
- to
- have
- you
- join
- us!
-
-
-
- If
- you
- have
- any
- questions,
- feel
- free
- to
- contact
- us
- at
- community@githubsrmist.in.
-