Skip to content

Commit

Permalink
Add allergies to admin ticket page
Browse files Browse the repository at this point in the history
  • Loading branch information
AmirAgassi authored and SherRao committed May 16, 2024
1 parent 0362f1b commit 5f724b4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
4 changes: 4 additions & 0 deletions functions/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@ async function internalGetTicketData(id: string, extended = false) {
let linkedin = "";
let github = "";
let resumeRef = "";
let allergies: string[] = [];

if (!app) {
// grab from user record
Expand All @@ -438,6 +439,7 @@ async function internalGetTicketData(id: string, extended = false) {
app.participatingAs === "Mentor"
? app.mentorResumeRef
: app.generalResumeRef;
allergies = app.allergies ?? [];
}

// get social ticket
Expand Down Expand Up @@ -467,6 +469,7 @@ async function internalGetTicketData(id: string, extended = false) {
pronouns,
foods: [] as string[],
events: [] as string[],
allergies,
...socials,
};

Expand All @@ -478,6 +481,7 @@ async function internalGetTicketData(id: string, extended = false) {
return data;
}


export const getTicketData = functions.https.onCall(async (data) => {
if (!z.string().uuid().safeParse(data.id).success) {
return response(HttpStatus.BAD_REQUEST, { message: "bad request" });
Expand Down
14 changes: 13 additions & 1 deletion src/pages/admin/ViewTicket.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,18 @@ export const AdminViewTicketPage = () => {
</h1>
<p>{ticketData.pronouns}</p>
</div>
<div className="mt-12">
<h2 className="font-medium text-xl mb-2">Allergies</h2>
{ticketData.allergies.length > 0 ? (
<ul className="list-disc list-inside">
{ticketData.allergies.map((allergy, index) => (
<li key={index}>{allergy}</li>
))}
</ul>
) : (
<p>No known allergies</p>
)}
</div>
<div className="mt-12">
<h2 className="font-medium text-xl mb-2">Events</h2>
<ul className="divide-y divide-gray-300 space-y-4">
Expand Down Expand Up @@ -216,4 +228,4 @@ export const AdminViewTicketPage = () => {
</Modal>
</>
);
};
};
2 changes: 2 additions & 0 deletions src/services/utils/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,10 @@ export interface TicketData {
export interface ExtendedTicketData extends TicketData {
foods: string[]; // id of the food items
events: string[]; // id of the event items
allergies: string[]; // list of allergies
}


export interface EventItem {
id: string;
title: string;
Expand Down

0 comments on commit 5f724b4

Please sign in to comment.