From 4425d8875c851cefec028a0c489b715b342a73df Mon Sep 17 00:00:00 2001 From: divinedab Date: Tue, 17 Sep 2024 01:27:36 -0500 Subject: [PATCH] added tshirt merch option --- src/config.ts | 7 ++++--- src/services/attendee/attendee-router.ts | 7 ++++--- src/services/attendee/attendee-schema.ts | 4 ++-- src/services/checkin/checkin-utils.ts | 2 +- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/config.ts b/src/config.ts index 0f50a98..00a6c53 100644 --- a/src/config.ts +++ b/src/config.ts @@ -11,8 +11,8 @@ export const Environment = z.enum(["PRODUCTION", "DEVELOPMENT", "TESTING"]); export const MailingListName = z.enum(["rp_interest"]); -const API_BASE = "https://api.reflectionsprojections.org"; -// const API_BASE = "http://localhost:3000"; +// const API_BASE = "https://api.reflectionsprojections.org"; +const API_BASE = "http://localhost:3000"; const WEB_BASE = "https://reflectionsprojections.org"; export const Config = { @@ -98,7 +98,8 @@ export const DeviceRedirects: Record = { web: `${WEB_BASE}/auth/`, dev: `${API_BASE}/auth/dev/`, mobile: "reflectionsprojections://--/Login", - admin: "https://admin.reflectionsprojections.org/auth/", + // admin: "https://admin.reflectionsprojections.org/auth/", + admin: "http://localhost:5173/auth/", pwa: "localhost:8081/Login", }; diff --git a/src/services/attendee/attendee-router.ts b/src/services/attendee/attendee-router.ts index c2afa70..dcdd930 100644 --- a/src/services/attendee/attendee-router.ts +++ b/src/services/attendee/attendee-router.ts @@ -230,7 +230,7 @@ attendeeRouter.get( // Get attendee info via userId attendeeRouter.get( "/id/:USERID", - RoleChecker([Role.Enum.USER]), + RoleChecker([Role.Enum.STAFF, Role.Enum.ADMIN]), async (req, res, next) => { try { const userId = req.params.USERID; @@ -274,8 +274,7 @@ attendeeRouter.post( RoleChecker([Role.Enum.STAFF, Role.Enum.ADMIN]), async (req, res, next) => { try { - const payload = res.locals.payload; - const userId = payload.userId; + const userId = req.body.userId; const merchItem = req.params.ITEM; // Check if the user exists in the database @@ -299,6 +298,8 @@ attendeeRouter.post( merchItem == "Tote" || merchItem == "Button" ) { + console.log("ELIGIBLE ", merchItem, user.isEligibleMerch![merchItem]) + console.log("REDEEMED ", merchItem, user.hasRedeemedMerch![merchItem]) if (!user.isEligibleMerch![merchItem]) { return res .status(StatusCodes.BAD_REQUEST) diff --git a/src/services/attendee/attendee-schema.ts b/src/services/attendee/attendee-schema.ts index 354d4c7..bc9bdb2 100644 --- a/src/services/attendee/attendee-schema.ts +++ b/src/services/attendee/attendee-schema.ts @@ -53,7 +53,7 @@ export const AttendeeSchema = new Schema({ isEligibleMerch: { type: new Schema( { - Tshirt: { type: Boolean, default: false }, + Tshirt: { type: Boolean, default: true }, Button: { type: Boolean, default: false }, Tote: { type: Boolean, default: false }, Cap: { type: Boolean, default: false }, @@ -61,7 +61,7 @@ export const AttendeeSchema = new Schema({ { _id: false } ), default: { - Tshirt: false, + Tshirt: true, Button: false, Tote: false, Cap: false, diff --git a/src/services/checkin/checkin-utils.ts b/src/services/checkin/checkin-utils.ts index fdffc78..17aab03 100644 --- a/src/services/checkin/checkin-utils.ts +++ b/src/services/checkin/checkin-utils.ts @@ -79,7 +79,7 @@ async function assignPixelsToUser(userId: string, pixels: number) { await Database.ATTENDEE.findOneAndUpdate( { userId }, - { $set: updatedFields } + { $set: updatedFields }, ); }