Skip to content

Commit

Permalink
Read in Tracon 2024 data (#1064)
Browse files Browse the repository at this point in the history
  • Loading branch information
Archinowsk authored Oct 28, 2024
1 parent f2fc6fa commit 83f64d9
Show file tree
Hide file tree
Showing 6 changed files with 1,552 additions and 13 deletions.
18 changes: 17 additions & 1 deletion server/src/kompassi/getProgramItemsFromKompassi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { logger } from "server/utils/logger";
import { config } from "shared/config";
import { EventName } from "shared/config/eventConfigTypes";
import { getProgramItemsFromFullProgram } from "server/kompassi/getProgramItemsFromFullProgram";
import { exhaustiveSwitchGuard } from "shared/utils/exhaustiveSwitchGuard";

export const getProgramItemsFromKompassi = async (
eventName: EventName,
Expand Down Expand Up @@ -130,6 +131,21 @@ const KompassiResponseFormSchema = z.object({
}),
});

const eventNameToKompassiEventName = (eventName: EventName): string => {
switch (eventName) {
case EventName.ROPECON:
return "ropecon";
case EventName.HITPOINT:
return "hitpoint";
case EventName.SOLMUKOHTA:
return "solmukohta";
case EventName.TRACON:
return "tracon";
default:
return exhaustiveSwitchGuard(eventName);
}
};

export const getProgramFromServer = async (): Promise<
Result<unknown, KompassiError>
> => {
Expand Down Expand Up @@ -164,7 +180,7 @@ export const getProgramFromServer = async (): Promise<
}
`,
variables: {
event: `${eventName.toLocaleLowerCase()}${eventYear}`,
event: `${eventNameToKompassiEventName(eventName)}${eventYear}`,
programTypes: Object.values(KompassiKonstiProgramType),
},
};
Expand Down
2 changes: 1 addition & 1 deletion server/src/kompassi/kompassiProgramItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export const KompassiProgramItemSchema = z.object({
);
return valid;
}),
konsti: z.array(z.nativeEnum(KompassiKonstiProgramType)).catch([]),
konsti: z.array(z.nativeEnum(KompassiKonstiProgramType)),
audience: z.array(z.nativeEnum(KompassiAudience)).catch((ctx) => {
if (!Array.isArray(ctx.input)) {
return [];
Expand Down
Loading

0 comments on commit 83f64d9

Please sign in to comment.