diff --git a/global-includes/email-address.ts b/global-includes/email-address.ts index d30af82..90350ca 100644 --- a/global-includes/email-address.ts +++ b/global-includes/email-address.ts @@ -25,6 +25,12 @@ export enum EmailSource { Early2023 = "2023EarlySignup", } +export enum EmailTemplates { + Application = "application", + Approved = "approved", + Welcome = "welcome" +} + // TODO: maybe replace with zod's email validation, for consistency export const isEmailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; @@ -61,7 +67,13 @@ export class Email { @BackendMethod({ allowed: true }) static async addEmailAndSendWelcome(email: Partial) { - RemoteProcedures.sendWelcome((await remult.repo(Email).insert(email)).address); + RemoteProcedures.sendTemplateEmail(EmailTemplates.Welcome, (await remult.repo(Email).insert(email)).address); + } + + // TODO: should this be here????? + @BackendMethod({ allowed: [ UserRole.Admin, UserRole.Staff ] }) + static async sendTemplateEmail(template: EmailTemplates, email: string) { + RemoteProcedures.sendTemplateEmail(template, email); } @BackendMethod({ allowed: [UserRole.Admin, UserRole.Staff] }) diff --git a/global-includes/rpc-declarations.ts b/global-includes/rpc-declarations.ts index d5f25b3..5de68e8 100644 --- a/global-includes/rpc-declarations.ts +++ b/global-includes/rpc-declarations.ts @@ -1,6 +1,6 @@ import { MailDataRequired } from "@sendgrid/mail"; import { AttachmentData } from "@sendgrid/helpers/classes/attachment"; -import { Email } from "./email-address.ts"; +import { Email, EmailTemplates } from "./email-address.ts"; import { SupportTicket, TicketMessage } from "./support-ticket.ts"; /** @@ -22,10 +22,7 @@ export class RemoteProcedures { /** General function to send KHE emails based on files, with the "KHE 2024 * Updates" unsubscribe group */ static sendUpdate: (emailHtmlFile: string, address: string) => Promise; - /** Specifically sends an email sign-up welcome email */ - static sendWelcome: (address: string) => Promise; - /** Specifically sends an application acknowledgement email */ - static sendApplicationAcknowledgement: (address: string) => Promise; + static sendTemplateEmail: (template: EmailTemplates, address: string) => Promise; static getDistinct: (collection: string, field: string) => Promise; static bulkDelete: (collection: string, filter: any) => Promise; static sendTo: ( @@ -41,8 +38,5 @@ export class RemoteProcedures { static sanitizeMessage: (message: TicketMessage) => TicketMessage; static deleteGridImages: (paths: string[]) => Promise; static getUserResumeFilename: (userID: string) => Promise; - /** - * If `base64Resume` is empty, any existing resume will be deleted - */ - static setUserResume: (userID: string, base64Resume: string | "", resumeFilename: string) => Promise; + static setUserResume: (userID: string, base64Resume: string | "", resumeFilename: string) => Promise; // If `base64Resume` is empty, any existing resume will be deleted } diff --git a/global-includes/users.ts b/global-includes/users.ts index 0c4b015..b85e275 100644 --- a/global-includes/users.ts +++ b/global-includes/users.ts @@ -2,7 +2,7 @@ import { BackendMethod, Entity, Fields, EntityBase, remult } from "remult"; import { VFields } from "./adaptations.ts"; import { UserRole } from "./common.ts"; import { z } from "zod"; -import { isEmailRegex } from "./email-address.ts"; +import { EmailTemplates, isEmailRegex } from "./email-address.ts"; import crypto from "crypto"; import { RemoteProcedures } from "./rpc-declarations.ts"; @@ -197,10 +197,8 @@ const noUpdate = { allowApiUpdate: false }; @Entity("users", { allowApiCrud: true, apiPrefilter: () => ( - remult.isAllowed([UserRole.Admin, UserRole.Staff]) ? - {} : - { id: remult.user?.id } - ), + remult.isAllowed([UserRole.Admin, UserRole.Staff]) ? {} : { id: remult.user?.id } + ), }) export class User extends EntityBase { @Fields.uuid() @@ -387,7 +385,8 @@ export class User extends EntityBase { user.submittedApplication = true; user.applicationApproved = false; await remult.repo(User).save(user); - RemoteProcedures.sendApplicationAcknowledgement( + RemoteProcedures.sendTemplateEmail( + EmailTemplates.Application, user.registration.email || user.email ); } @@ -402,14 +401,13 @@ export class User extends EntityBase { } } - @BackendMethod({allowed: true}) + @BackendMethod({ allowed: true }) static async getExistingResumeName() { const user = remult.user as User; if (!user) { throw "Not logged in"; - } else { - return await RemoteProcedures.getUserResumeFilename(user.id); } + return await RemoteProcedures.getUserResumeFilename(user.id); } @BackendMethod({ allowed: true }) diff --git a/package.json b/package.json index 37ae254..3e48bab 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "html-to-text": "^9.0.5", "mongodb": "^5.1.0", "multer": "^1.4.5-lts.1", - "nanoid": "^4.0.2", + "nanoid": "^5.0.6", "next": "^13.2.4", "next-usequerystate": "^1.7.2", "octokit": "^2.0.14", @@ -52,6 +52,7 @@ "react-dom": "^18.2.0", "react-dropzone": "^14.2.3", "react-quill": "^2.0.0", + "recharts": "^2.12.2", "remult": "0.24.1", "sass": "^1.60.0", "serve-static": "^1.15.0", diff --git a/public-frontend/index.html b/public-frontend/index.html index faa6ff6..aa4ddda 100644 --- a/public-frontend/index.html +++ b/public-frontend/index.html @@ -10,7 +10,7 @@ width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no, target-densitydpi=device-dpi"> - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/public-frontend/src/components/map.vue b/public-frontend/src/components/map.vue index 84ef69b..403ef9c 100644 --- a/public-frontend/src/components/map.vue +++ b/public-frontend/src/components/map.vue @@ -17,7 +17,7 @@

Parking

- The easiest parking space to use will be the Student Center Visitor Lot. + The easiest parking space to use will be the Student Center Visitor Lot, the R19 Lot or the R7 Lot directly next to Satterfield. After parking, walk towards the visitor center, and head left between the buildings. The DI Hub is located near the Honors College.

diff --git a/public-frontend/src/components/sponsors.vue b/public-frontend/src/components/sponsors.vue index 0880f50..e77e3af 100644 --- a/public-frontend/src/components/sponsors.vue +++ b/public-frontend/src/components/sponsors.vue @@ -1,15 +1,24 @@