Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

# yarn lint
# yarn build
yarn lint
yarn build
10 changes: 6 additions & 4 deletions client/src/app/makeuc-2025.css
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,12 @@ body {
padding-left: 10px;
}


[type="button"]:not([role="checkbox"]) span{
color: var(--foreground) !important;
opacity: 0.825 !important;
}

#title span {
background: linear-gradient(white, #38495a);
background-clip: text;
Expand Down Expand Up @@ -480,10 +486,6 @@ textarea::placeholder,
opacity: 0.65 !important;
}

[type="button"]:not([role="checkbox"]) span:not(#title span) {
color: var(--foreground) !important;
opacity: 0.825 !important;
}

.bg-destructive {
color: white !important;
Expand Down
2 changes: 1 addition & 1 deletion client/src/app/stats/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { PageTitle } from "~/components/general/typography";
import { Config } from "~/constants/config";


export const revalidate = Config.RevalidationFrequency;
export const dynamic = "force-dynamic";

export default function StatsPage() {
const year = new Date().getFullYear() - 1;
Expand Down
56 changes: 52 additions & 4 deletions client/src/features/judging/generated/graphql/graphql.ts

Large diffs are not rendered by default.

13 changes: 10 additions & 3 deletions client/src/features/registration/generated/graphql/gql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/
* Therefore it is highly recommended to use the babel or swc plugin for production.
*/
const documents = {
"mutation CreateRegistrant($data: RegistrantCreateInput!) {\n createRegistrant(data: $data) {\n id\n }\n}\n\nmutation VerifyRegistrant($id: ID!) {\n verifyRegistrant(id: $id) {\n id\n }\n}": types.CreateRegistrantDocument,
"query GetSchools($where: SchoolWhereInput!, $orderBy: [SchoolOrderByInput!]!, $skip: Int!, $take: Int!) {\n schools(where: $where, orderBy: $orderBy, skip: $skip, take: $take) {\n id\n name\n }\n}": types.GetSchoolsDocument,
"query GetCountries {\n schools(orderBy: {country: asc}, take: 1000) {\n country\n }\n}\n\nquery GetCities($countryId: Int) {\n cities(countryId: $countryId)\n}": types.GetCountriesDocument,
"mutation CreateRegistrant($data: RegistrantCreateInput!) {\n createRegistrant(data: $data) {\n id\n }\n}\n\nmutation VerifyRegistrant($id: ID!) {\n verifyRegistrant(id: $id) {\n id\n }\n}": types.CreateRegistrantDocument,
"query GetSchools($where: SchoolWhereInput!, $orderBy: [SchoolOrderByInput!]!, $skip: Int!, $take: Int!) {\n schools(where: $where, orderBy: $orderBy, skip: $skip, take: $take) {\n id\n name\n }\n}": types.GetSchoolsDocument,
};

/**
Expand All @@ -31,6 +32,12 @@ const documents = {
*/
export function graphql(source: string): unknown;


/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(source: "query GetCountries {\n schools(orderBy: {country: asc}, take: 1000) {\n country\n }\n}\n\nquery GetCities($countryId: Int) {\n cities(countryId: $countryId)\n}"): (typeof documents)["query GetCountries {\n schools(orderBy: {country: asc}, take: 1000) {\n country\n }\n}\n\nquery GetCities($countryId: Int) {\n cities(countryId: $countryId)\n}"];

/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
Expand All @@ -44,4 +51,4 @@ export function graphql(source: string) {
return (documents as any)[source] ?? {};
}

export type DocumentType<TDocumentNode extends DocumentNode<any, any>> = TDocumentNode extends DocumentNode< infer TType, any> ? TType : never;
export type DocumentType<TDocumentNode extends DocumentNode<any, any>> = TDocumentNode extends DocumentNode<infer TType, any> ? TType : never;
60 changes: 57 additions & 3 deletions client/src/features/registration/generated/graphql/graphql.ts

Large diffs are not rendered by default.

50 changes: 49 additions & 1 deletion client/src/generated/graphql/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -886,6 +886,8 @@ export type ProjectWhereUniqueInput = {

export type Query = {
__typename?: 'Query';
cities: Array<Maybe<Scalars['JSON']['output']>>;
countries: Array<Maybe<Scalars['JSON']['output']>>;
discordScheduledMessage?: Maybe<DiscordScheduledMessage>;
discordScheduledMessages?: Maybe<Array<DiscordScheduledMessage>>;
discordScheduledMessagesCount?: Maybe<Scalars['Int']['output']>;
Expand Down Expand Up @@ -914,6 +916,9 @@ export type Query = {
usersCount?: Maybe<Scalars['Int']['output']>;
};

export type QueryCitiesArgs = {
countryId?: InputMaybe<Scalars['Int']['input']>;
};

export type QueryDiscordScheduledMessageArgs = {
where: DiscordScheduledMessageWhereUniqueInput;
Expand Down Expand Up @@ -1078,6 +1083,7 @@ export enum QueryMode {

export type Registrant = {
__typename?: 'Registrant';
acceptAllAuthorization?: Maybe<Scalars['Boolean']['output']>;
acceptPhotoRelease?: Maybe<Scalars['Boolean']['output']>;
age?: Maybe<Scalars['Int']['output']>;
country?: Maybe<Scalars['String']['output']>;
Expand All @@ -1089,24 +1095,33 @@ export type Registrant = {
ethnicity?: Maybe<Scalars['String']['output']>;
expectedGraduationYear?: Maybe<Scalars['Int']['output']>;
firstName?: Maybe<Scalars['String']['output']>;
foodAllergy?: Maybe<Scalars['String']['output']>;
foodSuggestions?: Maybe<Scalars['String']['output']>;
gender?: Maybe<Scalars['String']['output']>;
hackathonsAttended?: Maybe<Scalars['Int']['output']>;
id: Scalars['ID']['output'];
invitedInPerson?: Maybe<Scalars['Boolean']['output']>;
lastName?: Maybe<Scalars['String']['output']>;
major?: Maybe<Scalars['String']['output']>;
makeucCodeOfConduct?: Maybe<Scalars['Boolean']['output']>;
makeucHackathonRules?: Maybe<Scalars['Boolean']['output']>;
makeucLiabilityRelease?: Maybe<Scalars['Boolean']['output']>;
mlhCodeOfConductAgreement?: Maybe<Scalars['Boolean']['output']>;
mlhEmailAgreement?: Maybe<Scalars['Boolean']['output']>;
mlhPrivacyPolicyAgreement?: Maybe<Scalars['Boolean']['output']>;
notes?: Maybe<Scalars['String']['output']>;
participationPreference?: Maybe<Scalars['String']['output']>;
phoneNumber?: Maybe<Scalars['String']['output']>;
registrationYear?: Maybe<Scalars['Int']['output']>;
resume?: Maybe<FileFieldOutput>;
school?: Maybe<School>;
tshirtSize?: Maybe<Scalars['String']['output']>;
user?: Maybe<User>;
verified?: Maybe<Scalars['Boolean']['output']>;
};

export type RegistrantCreateInput = {
acceptAllAuthorization?: InputMaybe<Scalars['Boolean']['input']>;
age?: InputMaybe<Scalars['Int']['input']>;
country?: InputMaybe<Scalars['String']['input']>;
createdAt?: InputMaybe<Scalars['DateTime']['input']>;
Expand All @@ -1115,16 +1130,24 @@ export type RegistrantCreateInput = {
ethnicity?: InputMaybe<Scalars['String']['input']>;
expectedGraduationYear?: InputMaybe<Scalars['Int']['input']>;
firstName?: InputMaybe<Scalars['String']['input']>;
foodAllergy?: InputMaybe<Scalars['String']['input']>;
foodSuggestions?: InputMaybe<Scalars['String']['input']>;
gender?: InputMaybe<Scalars['String']['input']>;
hackathonsAttended?: InputMaybe<Scalars['Int']['input']>;
lastName?: InputMaybe<Scalars['String']['input']>;
major?: InputMaybe<Scalars['String']['input']>;
makeucCodeOfConduct?: InputMaybe<Scalars['Boolean']['input']>;
makeucHackathonRules?: InputMaybe<Scalars['Boolean']['input']>;
makeucLiabilityRelease?: InputMaybe<Scalars['Boolean']['input']>;
mlhCodeOfConductAgreement?: InputMaybe<Scalars['Boolean']['input']>;
mlhEmailAgreement?: InputMaybe<Scalars['Boolean']['input']>;
mlhPrivacyPolicyAgreement?: InputMaybe<Scalars['Boolean']['input']>;
notes?: InputMaybe<Scalars['String']['input']>;
participationPreference?: InputMaybe<Scalars['String']['input']>;
phoneNumber?: InputMaybe<Scalars['String']['input']>;
resume?: InputMaybe<FileFieldInput>;
school?: InputMaybe<SchoolRelateToOneForCreateInput>;
tshirtSize?: InputMaybe<Scalars['String']['input']>;
user?: InputMaybe<UserRelateToOneForCreateInput>;
};

Expand All @@ -1135,6 +1158,7 @@ export type RegistrantManyRelationFilter = {
};

export type RegistrantOrderByInput = {
acceptAllAuthorization?: InputMaybe<OrderDirection>;
acceptPhotoRelease?: InputMaybe<OrderDirection>;
age?: InputMaybe<OrderDirection>;
country?: InputMaybe<OrderDirection>;
Expand All @@ -1146,17 +1170,25 @@ export type RegistrantOrderByInput = {
ethnicity?: InputMaybe<OrderDirection>;
expectedGraduationYear?: InputMaybe<OrderDirection>;
firstName?: InputMaybe<OrderDirection>;
foodAllergy?: InputMaybe<OrderDirection>;
foodSuggestions?: InputMaybe<OrderDirection>;
gender?: InputMaybe<OrderDirection>;
hackathonsAttended?: InputMaybe<OrderDirection>;
id?: InputMaybe<OrderDirection>;
invitedInPerson?: InputMaybe<OrderDirection>;
lastName?: InputMaybe<OrderDirection>;
major?: InputMaybe<OrderDirection>;
makeucCodeOfConduct?: InputMaybe<OrderDirection>;
makeucHackathonRules?: InputMaybe<OrderDirection>;
makeucLiabilityRelease?: InputMaybe<OrderDirection>;
mlhCodeOfConductAgreement?: InputMaybe<OrderDirection>;
mlhEmailAgreement?: InputMaybe<OrderDirection>;
mlhPrivacyPolicyAgreement?: InputMaybe<OrderDirection>;
notes?: InputMaybe<OrderDirection>;
participationPreference?: InputMaybe<OrderDirection>;
phoneNumber?: InputMaybe<OrderDirection>;
registrationYear?: InputMaybe<OrderDirection>;
tshirtSize?: InputMaybe<OrderDirection>;
verified?: InputMaybe<OrderDirection>;
};

Expand All @@ -1178,6 +1210,7 @@ export type RegistrantUpdateArgs = {
};

export type RegistrantUpdateInput = {
acceptAllAuthorization?: InputMaybe<Scalars['Boolean']['input']>;
age?: InputMaybe<Scalars['Int']['input']>;
country?: InputMaybe<Scalars['String']['input']>;
createdAt?: InputMaybe<Scalars['DateTime']['input']>;
Expand All @@ -1186,23 +1219,30 @@ export type RegistrantUpdateInput = {
ethnicity?: InputMaybe<Scalars['String']['input']>;
expectedGraduationYear?: InputMaybe<Scalars['Int']['input']>;
firstName?: InputMaybe<Scalars['String']['input']>;
foodAllergy?: InputMaybe<Scalars['String']['input']>;
foodSuggestions?: InputMaybe<Scalars['String']['input']>;
gender?: InputMaybe<Scalars['String']['input']>;
hackathonsAttended?: InputMaybe<Scalars['Int']['input']>;
lastName?: InputMaybe<Scalars['String']['input']>;
major?: InputMaybe<Scalars['String']['input']>;
makeucCodeOfConduct?: InputMaybe<Scalars['Boolean']['input']>;
makeucHackathonRules?: InputMaybe<Scalars['Boolean']['input']>;
makeucLiabilityRelease?: InputMaybe<Scalars['Boolean']['input']>;
mlhCodeOfConductAgreement?: InputMaybe<Scalars['Boolean']['input']>;
mlhEmailAgreement?: InputMaybe<Scalars['Boolean']['input']>;
mlhPrivacyPolicyAgreement?: InputMaybe<Scalars['Boolean']['input']>;
notes?: InputMaybe<Scalars['String']['input']>;
resume?: InputMaybe<FileFieldInput>;
school?: InputMaybe<SchoolRelateToOneForUpdateInput>;
tshirtSize?: InputMaybe<Scalars['String']['input']>;
user?: InputMaybe<UserRelateToOneForUpdateInput>;
};

export type RegistrantWhereInput = {
AND?: InputMaybe<Array<RegistrantWhereInput>>;
NOT?: InputMaybe<Array<RegistrantWhereInput>>;
OR?: InputMaybe<Array<RegistrantWhereInput>>;
acceptAllAuthorization?: InputMaybe<BooleanFilter>;
acceptPhotoRelease?: InputMaybe<BooleanFilter>;
age?: InputMaybe<IntFilter>;
country?: InputMaybe<StringFilter>;
Expand All @@ -1214,18 +1254,26 @@ export type RegistrantWhereInput = {
ethnicity?: InputMaybe<StringFilter>;
expectedGraduationYear?: InputMaybe<IntFilter>;
firstName?: InputMaybe<StringFilter>;
foodAllergy?: InputMaybe<StringFilter>;
foodSuggestions?: InputMaybe<StringFilter>;
gender?: InputMaybe<StringFilter>;
hackathonsAttended?: InputMaybe<IntNullableFilter>;
id?: InputMaybe<IdFilter>;
invitedInPerson?: InputMaybe<BooleanFilter>;
lastName?: InputMaybe<StringFilter>;
major?: InputMaybe<StringFilter>;
makeucCodeOfConduct?: InputMaybe<BooleanFilter>;
makeucHackathonRules?: InputMaybe<BooleanFilter>;
makeucLiabilityRelease?: InputMaybe<BooleanFilter>;
mlhCodeOfConductAgreement?: InputMaybe<BooleanFilter>;
mlhEmailAgreement?: InputMaybe<BooleanFilter>;
mlhPrivacyPolicyAgreement?: InputMaybe<BooleanFilter>;
notes?: InputMaybe<StringFilter>;
participationPreference?: InputMaybe<StringFilter>;
phoneNumber?: InputMaybe<StringFilter>;
registrationYear?: InputMaybe<IntNullableFilter>;
school?: InputMaybe<SchoolWhereInput>;
tshirtSize?: InputMaybe<StringFilter>;
user?: InputMaybe<UserWhereInput>;
verified?: InputMaybe<BooleanFilter>;
};
Expand Down Expand Up @@ -1514,4 +1562,4 @@ export type GetStatisticsQueryVariables = Exact<{
export type GetStatisticsQuery = { __typename?: 'Query', statistics?: string | null };


export const GetStatisticsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetStatistics"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"year"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"statistics"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"year"},"value":{"kind":"Variable","name":{"kind":"Name","value":"year"}}}]}]}}]} as unknown as DocumentNode<GetStatisticsQuery, GetStatisticsQueryVariables>;
export const GetStatisticsDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "GetStatistics" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "year" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "Int" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "statistics" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "year" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "year" } } }] }] } }] } as unknown as DocumentNode<GetStatisticsQuery, GetStatisticsQueryVariables>;
13 changes: 7 additions & 6 deletions server/admin/pages/utilities.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,26 @@ import { Heading, H1, H3 } from "@keystone-ui/core";

import type { FormEventHandler } from "react";


export const gql = ([content]: TemplateStringsArray) => content;

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export async function fetchGraphQL(
query: string,
variables?: Record<string, any>
variables?: Record<string, unknown>
) {
return fetch("/api/graphql", {
method: "POST",
body: JSON.stringify({ query, variables }),
headers: { "Content-Type": "application/json" },
})
.then((x) => x.json())
.then(x => x.json())
.then(({ data, errors }) => {
if (errors) {
throw new Error(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
`GraphQL errors occurred:\n${errors
.map((x: any) => x.message)
.map((x: { message: string }) => x.message)
.join("\n")}`
);
}
Expand All @@ -38,7 +39,7 @@ async function seedIndiaSchools() {
`);
}

const importRegistrants: FormEventHandler<HTMLFormElement> = (event) => {
const importRegistrants: FormEventHandler<HTMLFormElement> = event => {
event.preventDefault();

const formData = new FormData(event.target as HTMLFormElement);
Expand All @@ -49,7 +50,7 @@ const importRegistrants: FormEventHandler<HTMLFormElement> = (event) => {
});
};

const importProjects: FormEventHandler<HTMLFormElement> = (event) => {
const importProjects: FormEventHandler<HTMLFormElement> = event => {
event.preventDefault();

const formData = new FormData(event.target as HTMLFormElement);
Expand Down Expand Up @@ -134,7 +135,7 @@ export default function UtilitiesPage() {
}
const blob = await resp.blob();
const disposition = resp.headers.get("content-disposition") || "";
let filename = `judgements_export_${new Date().toISOString().slice(0,19).replace("T","_").replace(/:/g, "-")}.zip`;
let filename = `judgements_export_${new Date().toISOString().slice(0, 19).replace("T", "_").replace(/:/g, "-")}.zip`;
const match = disposition.match(/filename="?([^";]+)"?/);
if (match) filename = match[1];
const link = document.createElement("a");
Expand Down
6 changes: 5 additions & 1 deletion server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
"typescript": "^4.9.5",
"zod": "^3.22.3"
},
"optionalDependencies": {
"@esbuild/darwin-arm64": "0.20.2",
"@esbuild/darwin-x64": "0.20.2"
},
"devDependencies": {
"@types/archiver": "^5.1.1",
"@types/express-fileupload": "^1.4.1",
Expand All @@ -54,4 +58,4 @@
"npm": "please-use-yarn",
"yarn": ">= 1.19.1"
}
}
}
2 changes: 2 additions & 0 deletions server/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,8 @@ type Query {
passportStrategyStorage(where: PassportStrategyStorageWhereUniqueInput!): PassportStrategyStorage
passportStrategyStoragesCount(where: PassportStrategyStorageWhereInput! = {}): Int
keystone: KeystoneMeta!
countries: [JSON]!
cities(countryId: Int): [JSON]!
statistics(year: Int!): String
}

Expand Down
17 changes: 13 additions & 4 deletions server/src/graphql/helpers/geography.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,19 @@ export const initializeGeographyState = async (): Promise<GeographyState | null>

// First pass: Initialize countries
for (const country of countriesData) {
countries.set(country.id, {
...country,
states: country.hasStates ? new Map<number, State>() : undefined,
});
if (country.hasStates) {
countries.set(country.id, {
...country,
hasStates: true,
states: new Map<number, State>(),
});
} else {
countries.set(country.id, {
...country,
hasStates: false,
cities: new Map<number, City>(),
});
}
}

// Second pass: Link states to countries
Expand Down
Loading