Skip to content

Commit

Permalink
Updated roster check to give max permissions if on DEV_MODE
Browse files Browse the repository at this point in the history
  • Loading branch information
beabravedude committed Jan 28, 2025
1 parent f5b71a7 commit df24536
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions app/api/update/roster/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down

0 comments on commit df24536

Please sign in to comment.