From 0c2a7fe49db91e90d509f54fcb66ca4bc876435a Mon Sep 17 00:00:00 2001 From: Kevin Wu <95104238+kevinwu15@users.noreply.github.com> Date: Wed, 18 Oct 2023 18:43:12 -0400 Subject: [PATCH 01/42] Task 573 next previous buttons (#103) Demo of changes:  Changes: Added new hacker routers to get the next and previous hacker from a unique id (in the url) using cursor-based pagination. Buttons are just preliminary and should be changed based on desired design later --- src/pages/hackers/hacker.tsx | 21 ++++++++++++ src/server/api/routers/hackers.ts | 54 +++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) diff --git a/src/pages/hackers/hacker.tsx b/src/pages/hackers/hacker.tsx index 0009f983..50bd8ea1 100644 --- a/src/pages/hackers/hacker.tsx +++ b/src/pages/hackers/hacker.tsx @@ -27,6 +27,9 @@ const Hacker: NextPage = () => { const hackerQuery = trpc.hackers.get.useQuery({ id: id ?? "" }, { enabled: !!id }); const presenceQuery = trpc.presence.getFromHackerId.useQuery({ id: id ?? "" }, { enabled: !!id }); + + const nextHackerQuery = trpc.hackers.getNext.useQuery({ id: id ?? "" }, { enabled: !!id }); + const prevHackerQuery = trpc.hackers.getPrev.useQuery({ id: id ?? "" }, { enabled: !!id }); if (hackerQuery.isLoading || hackerQuery.data == null) { return ( @@ -82,6 +85,24 @@ const Hacker: NextPage = () => { >
- {hackerData.studyLevel} {hackerData.studyProgram}{" "} + {hackerData.studyLevel?.toUpperCase()} {hackerData.studyProgram}{" "} {hackerData.university && `at ${hackerData.university}`}{" "} {hackerData.graduationYear && `(${hackerData.graduationYear})`}
@@ -155,6 +419,7 @@ const HackerView = ({ hackerData, presenceData: { id: _, hackerInfoId, ...presen {Object.entries(presenceState).map(([key, value]) => (-
- Contact Information {hackerData.email} — {hackerData.phoneNumber} -
-- Emergency Contact {hackerData.emergencyContactName} ( - {hackerData.emergencyContactRelationship}) {hackerData.emergencyContactPhoneNumber} -
-- Requirements - {hackerData.dietaryRestrictions - ? hackerData.dietaryRestrictions - : "No Dietary Restrictions"} —{" "} - {hackerData.accessibilityRequirements - ? hackerData.accessibilityRequirements - : "No Accessibility Requirements"}{" "} - — {hackerData.preferredLanguage} — {hackerData.shirtSize} -
-- Attendance - {hackerData.confirmed ? "Confirmed attendance" : "Unconfirmed attendance"} - {hackerData.walkIn ? " (walk-in)" : ""} —{" "} - {hackerData.unsubscribed ? "Unsubscribed from emails" : "Subscribed to emails"} — Attends{" "} - {hackerData.attendanceType} at {hackerData.location} with{" "} - {hackerData.transportationRequired ? "" : "no"} transportation required -
-- {Object.entries({ - Resume: hackerData.linkResume, - LinkedIn: hackerData.linkLinkedin, - GitHub: hackerData.linkGithub, - "Personal Website": hackerData.linkPersonalSite, - }).map( - ([key, value]) => - value && ( - - {key} - - ), + +
> ); }; diff --git a/src/server/api/routers/hackers.ts b/src/server/api/routers/hackers.ts index 7c20d096..d350e465 100644 --- a/src/server/api/routers/hackers.ts +++ b/src/server/api/routers/hackers.ts @@ -277,6 +277,39 @@ export const hackerRouter = createTRPCRouter({ }, }); + return hacker; + }), + + // Update a hacker's info + update: protectedProcedure + .input( + walkInSchema.extend({ + id: z.string(), + }), + ) + .mutation(async ({ ctx, input }) => { + const userId = ctx.session.user.id; + const user = await ctx.prisma.user.findUnique({ + where: { + id: userId, + }, + }); + + if (!user) { + throw new Error("User not found"); + } + + if (input.id !== userId && !hasRoles(user, [Role.ORGANIZER])) { + throw new Error("You do not have permission to do this"); + } + + const hacker = await ctx.prisma.hackerInfo.update({ + where: { + id: input.id, + }, + data: input, + }); + return hacker; }), }); From ac21f3efcfcd4889aa78d037e75ee16076b08d1a Mon Sep 17 00:00:00 2001 From: ouyix- Hack the Hill is an event that will run from February 2nd to 4th 2024, along with a series of monthly + Hack the Hill is an event that will run in the Fall of 2024, along with a series of monthly events throughout the year. We are shaping the future of technology through the joint effort of notable student organizations from both the University of Ottawa and Carleton University.
@@ -94,7 +94,7 @@ const templates = [ 1000 passionate North American students who are ready to push the boundaries of software and hardware solutions. We are shaping the future of technology through the joint effort of notable student organizations from both the University of Ottawa and - Carleton University. From February 2nd to 4th 2024, we will transform + Carleton University. In the Fall of 2024, we will transform the campus into a hub for new ideas and flourishing projects. This is where ideas come to life, where technology thrives, and where your company's brand can truly shine. @@ -240,9 +240,9 @@ const templates = [ throughout the year.- This year, we/they will be hosting about 1,000 participants from across North America - who will receive the opportunity to innovate software and hardware solutions from February 2nd to 4th, - 2024. Events like these could not happen without the support of our sponsors.we/they + In the Fall of 2024, we/they will be hosting about 1,000 participants from across North America + who will receive the opportunity to innovate software and hardware solutions. Events like these could + not happen without the support of our sponsors.we/they encourage you to take a look at the sponsorship package, which I have attached. we/they are more than happy to answer any questions you may have!
From b9c22d76ee6aa375be2c6ee7f24504d8444c818d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CF=BBartin?= <51332188+martin0024@users.noreply.github.com> Date: Fri, 24 Nov 2023 16:31:17 -0500 Subject: [PATCH 05/42] feat: audit logging (#101) https://project.hackthehill.com/projects/track-the-hack/work_packages/585/activity --------- Co-authored-by: macsaheen