From df8ed099f39fbf7b75228d36ab27777b8be96474 Mon Sep 17 00:00:00 2001 From: Steven Date: Sun, 10 Aug 2025 18:22:45 +1000 Subject: [PATCH 1/2] update readme --- README.md | 2 +- functions/index.js | 252 +++++++++++++++++++++++++++++++++++++++------ 2 files changed, 224 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 76407a9..949cac5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -## Getting Startsd +## Getting Started 1. Clone the repository 2. Once you've cloned the repo, run `npm install` to install all of the node_modules diff --git a/functions/index.js b/functions/index.js index 7be528a..350b367 100644 --- a/functions/index.js +++ b/functions/index.js @@ -211,32 +211,226 @@ exports.getLinksPage = onCall( }, ); -// exports.setRiserData = onCall(async (req) => { -// console.log(req.data.name); -// const result = { -// name: req.data.name, -// email: req.data.email, -// studentID: req.data.studentID, -// HMMember: req.data.HMMember, -// gameData: req.data.gameData, -// }; - -// await getFirestore().collection("riserData").add(result); - -// return { text: "hi" }; -// }); - -// exports.setRiserData = onCall(async (req) => { -// console.log(req.data.name); -// const result = { -// name: req.data.name, -// email: req.data.email, -// studentID: req.data.studentID, -// HMMember: req.data.HMMember, -// gameData: req.data.gameData, -// }; - -// await getFirestore().collection("riserData").add(result); - -// return { text: "hi" }; -// }); +// Application Management Functions +exports.getApplications = onCall( + { + cors: CORSLIST, + region: SERVERLOCATION, + }, + async () => { + const databaseId = process.env.NOTION_APPLICATIONS_DATABASE_ID || "your-applications-database-id"; + + try { + // Fetching Notion Data + const response = await notion.databases.query({ + database_id: databaseId, + sorts: [ + { + property: "Submission Date", + direction: "descending", + }, + ], + }); + + // Parse Notion Data to required format + const result = []; + + response.results.map((value) => { + const props = value.properties; + + // Getting data into format required by frontend + const applicationItem = { + id: value.id, + name: props.Name?.title[0]?.plain_text || "", + email: props.Email?.email || "", + position: props.Position?.select?.name || "", + university: props.University?.select?.name || "", + status: props.Status?.select?.name || "Pending", + submissionDate: props["Submission Date"]?.date?.start || "", + notes: props.Notes?.rich_text[0]?.plain_text || "", + }; + result.push(applicationItem); + }); + + return result; + } catch (e) { + console.error("Error fetching applications:", e); + return []; + } + }, +); + +exports.updateApplicationStatus = onCall( + { + cors: CORSLIST, + region: SERVERLOCATION, + }, + async (req) => { + const { applicationId, status, notes } = req.data; + const databaseId = process.env.NOTION_APPLICATIONS_DATABASE_ID || "your-applications-database-id"; + + try { + await notion.pages.update({ + page_id: applicationId, + properties: { + Status: { + select: { + name: status, + }, + }, + Notes: { + rich_text: [ + { + text: { + content: notes || "", + }, + }, + ], + }, + }, + }); + + return { success: true, message: "Application status updated successfully" }; + } catch (e) { + console.error("Error updating application status:", e); + return { success: false, message: "Failed to update application status" }; + } + }, +); + +// Function to sync new applications from Firestore to Notion +// This would typically be triggered by a Firestore document creation +exports.syncApplicationToNotion = onCall( + { + cors: CORSLIST, + region: SERVERLOCATION, + }, + async (req) => { + const { applicationData } = req.data; + const databaseId = process.env.NOTION_APPLICATIONS_DATABASE_ID || "your-applications-database-id"; + + try { + const response = await notion.pages.create({ + parent: { + database_id: databaseId, + }, + properties: { + Name: { + title: [ + { + text: { + content: `${applicationData.firstName} ${applicationData.lastName}`, + }, + }, + ], + }, + Email: { + email: applicationData.email, + }, + Phone: { + phone_number: applicationData.phone, + }, + "Student ID": { + rich_text: [ + { + text: { + content: applicationData.studentId || "Not provided", + }, + }, + ], + }, + University: { + select: { + name: applicationData.university, + }, + }, + Degree: { + rich_text: [ + { + text: { + content: applicationData.degree, + }, + }, + ], + }, + "Graduation Year": { + rich_text: [ + { + text: { + content: applicationData.graduationYear, + }, + }, + ], + }, + Position: { + select: { + name: applicationData.position, + }, + }, + Motivation: { + rich_text: [ + { + text: { + content: applicationData.motivation, + }, + }, + ], + }, + Experience: { + rich_text: [ + { + text: { + content: applicationData.experience, + }, + }, + ], + }, + Skills: { + multi_select: applicationData.skills.map(skill => ({ name: skill })), + }, + Availability: { + rich_text: [ + { + text: { + content: applicationData.availability, + }, + }, + ], + }, + "Time Commitment": { + select: { + name: applicationData.timeCommitment, + }, + }, + Portfolio: { + url: applicationData.portfolio || null, + }, + LinkedIn: { + url: applicationData.linkedin || null, + }, + GitHub: { + url: applicationData.github || null, + }, + Resume: { + url: applicationData.resume || null, + }, + Status: { + select: { + name: "Pending", + }, + }, + "Submission Date": { + date: { + start: new Date().toISOString(), + }, + }, + }, + }); + + return { success: true, notionPageId: response.id }; + } catch (e) { + console.error("Error syncing application to Notion:", e); + return { success: false, error: e.message }; + } + }, +); From 9aec29db71cc0c06eb4e6152e341f8378bc9d8cb Mon Sep 17 00:00:00 2001 From: Steven Date: Sun, 10 Aug 2025 18:58:08 +1000 Subject: [PATCH 2/2] update melb hack description --- functions/index.js | 252 +++++------------------------------------- src/routes/Events.tsx | 4 +- 2 files changed, 31 insertions(+), 225 deletions(-) diff --git a/functions/index.js b/functions/index.js index 350b367..53a93b5 100644 --- a/functions/index.js +++ b/functions/index.js @@ -211,226 +211,32 @@ exports.getLinksPage = onCall( }, ); -// Application Management Functions -exports.getApplications = onCall( - { - cors: CORSLIST, - region: SERVERLOCATION, - }, - async () => { - const databaseId = process.env.NOTION_APPLICATIONS_DATABASE_ID || "your-applications-database-id"; - - try { - // Fetching Notion Data - const response = await notion.databases.query({ - database_id: databaseId, - sorts: [ - { - property: "Submission Date", - direction: "descending", - }, - ], - }); - - // Parse Notion Data to required format - const result = []; - - response.results.map((value) => { - const props = value.properties; - - // Getting data into format required by frontend - const applicationItem = { - id: value.id, - name: props.Name?.title[0]?.plain_text || "", - email: props.Email?.email || "", - position: props.Position?.select?.name || "", - university: props.University?.select?.name || "", - status: props.Status?.select?.name || "Pending", - submissionDate: props["Submission Date"]?.date?.start || "", - notes: props.Notes?.rich_text[0]?.plain_text || "", - }; - result.push(applicationItem); - }); - - return result; - } catch (e) { - console.error("Error fetching applications:", e); - return []; - } - }, -); - -exports.updateApplicationStatus = onCall( - { - cors: CORSLIST, - region: SERVERLOCATION, - }, - async (req) => { - const { applicationId, status, notes } = req.data; - const databaseId = process.env.NOTION_APPLICATIONS_DATABASE_ID || "your-applications-database-id"; - - try { - await notion.pages.update({ - page_id: applicationId, - properties: { - Status: { - select: { - name: status, - }, - }, - Notes: { - rich_text: [ - { - text: { - content: notes || "", - }, - }, - ], - }, - }, - }); - - return { success: true, message: "Application status updated successfully" }; - } catch (e) { - console.error("Error updating application status:", e); - return { success: false, message: "Failed to update application status" }; - } - }, -); - -// Function to sync new applications from Firestore to Notion -// This would typically be triggered by a Firestore document creation -exports.syncApplicationToNotion = onCall( - { - cors: CORSLIST, - region: SERVERLOCATION, - }, - async (req) => { - const { applicationData } = req.data; - const databaseId = process.env.NOTION_APPLICATIONS_DATABASE_ID || "your-applications-database-id"; - - try { - const response = await notion.pages.create({ - parent: { - database_id: databaseId, - }, - properties: { - Name: { - title: [ - { - text: { - content: `${applicationData.firstName} ${applicationData.lastName}`, - }, - }, - ], - }, - Email: { - email: applicationData.email, - }, - Phone: { - phone_number: applicationData.phone, - }, - "Student ID": { - rich_text: [ - { - text: { - content: applicationData.studentId || "Not provided", - }, - }, - ], - }, - University: { - select: { - name: applicationData.university, - }, - }, - Degree: { - rich_text: [ - { - text: { - content: applicationData.degree, - }, - }, - ], - }, - "Graduation Year": { - rich_text: [ - { - text: { - content: applicationData.graduationYear, - }, - }, - ], - }, - Position: { - select: { - name: applicationData.position, - }, - }, - Motivation: { - rich_text: [ - { - text: { - content: applicationData.motivation, - }, - }, - ], - }, - Experience: { - rich_text: [ - { - text: { - content: applicationData.experience, - }, - }, - ], - }, - Skills: { - multi_select: applicationData.skills.map(skill => ({ name: skill })), - }, - Availability: { - rich_text: [ - { - text: { - content: applicationData.availability, - }, - }, - ], - }, - "Time Commitment": { - select: { - name: applicationData.timeCommitment, - }, - }, - Portfolio: { - url: applicationData.portfolio || null, - }, - LinkedIn: { - url: applicationData.linkedin || null, - }, - GitHub: { - url: applicationData.github || null, - }, - Resume: { - url: applicationData.resume || null, - }, - Status: { - select: { - name: "Pending", - }, - }, - "Submission Date": { - date: { - start: new Date().toISOString(), - }, - }, - }, - }); - - return { success: true, notionPageId: response.id }; - } catch (e) { - console.error("Error syncing application to Notion:", e); - return { success: false, error: e.message }; - } - }, -); +// exports.setRiserData = onCall(async (req) => { +// console.log(req.data.name); +// const result = { +// name: req.data.name, +// email: req.data.email, +// studentID: req.data.studentID, +// HMMember: req.data.HMMember, +// gameData: req.data.gameData, +// }; + +// await getFirestore().collection("riserData").add(result); + +// return { text: "hi" }; +// }); + +// exports.setRiserData = onCall(async (req) => { +// console.log(req.data.name); +// const result = { +// name: req.data.name, +// email: req.data.email, +// studentID: req.data.studentID, +// HMMember: req.data.HMMember, +// gameData: req.data.gameData, +// }; + +// await getFirestore().collection("riserData").add(result); + +// return { text: "hi" }; +// }); \ No newline at end of file diff --git a/src/routes/Events.tsx b/src/routes/Events.tsx index 72b6834..7744bdf 100644 --- a/src/routes/Events.tsx +++ b/src/routes/Events.tsx @@ -46,9 +46,9 @@ const Events = () => { }, { name: "Melbourne Hack", - date: "30/8 - 01/9", + date: "30/8 - 06/9", brief: "Free entry, great competition", - description: `Melbourne Hack, our main competition, brings together students from across the state for a weekend of intense hacking. Scheduled for Semester 2, this annual event provides the opportunity to collaborate with talented peers, connect with industry-leading companies, develop strong technical skills, and win amazing prizes!`, + description: `Melbourne Hack is a hackathon where participants use their entrepreneurial skills to build a product in 3 days. Given certain themes, participants will have to build something that solves a problem or meets a need. Then they will be able to pitch their product to a panel of judges!`, bgImage: MelbHackImage, frontImage: MelbHackImage2, altBgImage: "Students sitting in a lecture hall discussing amongst themselves.",