From df245360f70319349c06940087127d3e1e6a994c Mon Sep 17 00:00:00 2001 From: Aneesh Reddy Date: Mon, 27 Jan 2025 21:56:15 -0500 Subject: [PATCH] Updated roster check to give max permissions if on DEV_MODE --- app/api/update/roster/route.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/app/api/update/roster/route.ts b/app/api/update/roster/route.ts index 84e39d5..2c70aa1 100644 --- a/app/api/update/roster/route.ts +++ b/app/api/update/roster/route.ts @@ -10,11 +10,14 @@ import {assignNextProgressionOrRemove, getProgressionStatus} from "@/actions/pro export const dynamic = 'force-dynamic'; +const DEV_MODE = process.env['DEV_MODE'] === 'true'; + export async function GET() { const users = await prisma.user.findMany(); for (const user of users) { + if (!user.excludedFromVatusaRosterUpdate) { const vatusaData = await getVatusaData(user as User, users as User[]); let newOperatingInitials = user.operatingInitials; @@ -23,6 +26,25 @@ export async function GET() { } else if (user.controllerStatus === "NONE") { newOperatingInitials = await getOperatingInitials(user.firstName || '', user.lastName || '', users.map(user => user.operatingInitials).filter(initial => initial !== null) as string[]); } + + if (DEV_MODE) { + await prisma.user.update({ + where: { + id: user.id + }, + data: { + controllerStatus: "HOME", + operatingInitials: newOperatingInitials, + roles: { + set: ['CONTROLLER', 'MENTOR', 'INSTRUCTOR', 'STAFF', 'EVENT_STAFF'], + }, + staffPositions: { + set: ['ATM'], + }, + }, + }); + } + await prisma.user.update({ where: { id: user.id