Skip to content

Commit

Permalink
Many changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jthoward64 committed Jan 5, 2025
1 parent c601982 commit 5260671
Show file tree
Hide file tree
Showing 48 changed files with 2,538 additions and 1,303 deletions.
28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@
},
"devDependencies": {
"@eslint/compat": "^1.2.4",
"@eslint/config-inspector": "^0.5.6",
"@eslint/config-inspector": "^0.7.0",
"@eslint/eslintrc": "^3.2.0",
"@eslint/js": "^9.16.0",
"@eslint/js": "^9.17.0",
"@expo/ngrok": "^4.1.3",
"@graphql-codegen/cli": "^5.0.3",
"@graphql-codegen/client-preset": "patch:@graphql-codegen/client-preset@npm%3A4.4.0#~/.yarn/patches/@graphql-codegen-client-preset-npm-4.4.0-d441b92060.patch",
Expand All @@ -77,35 +77,35 @@
"@types/eslint__js": "^8.42.3",
"@types/react": "~18.3.14",
"@types/react-dom": "~18.3.2",
"@typescript-eslint/utils": "^8.17.0",
"@typescript-eslint/utils": "^8.19.0",
"@vitest/coverage-v8": "^2.1.8",
"@vitest/eslint-plugin": "^1.1.14",
"@vitest/eslint-plugin": "^1.1.24",
"@vitest/ui": "^2.1.8",
"@yarnpkg/types": "^4.0.0",
"babel-cli": "^6.26.0",
"chokidar-cli": "^3.0.0",
"eslint": "9.16.0",
"eslint": "9.17.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-n": "^17.14.0",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-n": "^17.15.1",
"eslint-plugin-react": "^7.37.3",
"eslint-plugin-react-hooks": "^5.1.0",
"eslint-plugin-react-refresh": "^0.4.16",
"eslint-plugin-simple-import-sort": "^12.1.1",
"eslint-plugin-unicorn": "^56.0.1",
"globals": "^15.13.0",
"graphql": "^16.9.0",
"globals": "^15.14.0",
"graphql": "^16.10.0",
"graphql-scalars": "^1.24.0",
"node-gyp": "^11.0.0",
"prettier": "^3.4.2",
"sort-package-json": "^2.12.0",
"ts-node": "^10.9.2",
"typedoc": "^0.27.3",
"typedoc-plugin-dt-links": "^1.1.2",
"typedoc-plugin-mdn-links": "^4.0.4",
"typedoc": "^0.27.6",
"typedoc-plugin-dt-links": "^1.1.6",
"typedoc-plugin-mdn-links": "^4.0.6",
"typedoc-plugin-missing-exports": "^3.1.0",
"typedoc-plugin-zod": "^1.3.0",
"typedoc-plugin-zod": "^1.3.1",
"typescript": "^5.7.2",
"typescript-eslint": "^8.17.0",
"typescript-eslint": "^8.19.0",
"vitest": "^2.1.8"
},
"packageManager": "[email protected]+sha512.3003a14012e2987072d244c720506549c1aab73ee728208f1b2580a9fd67b92d61ba6b08fe93f6dce68fd771e3af1e59a0afa28dd242dd0940d73b95fedd4e90"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import { GraphQLNonNegativeInt, GraphQLPositiveInt } from "graphql-scalars";
import {
GraphQLNonEmptyString,
GraphQLNonNegativeInt,
GraphQLPositiveInt,
} from "graphql-scalars";
import { ArgsType, Field, InputType, registerEnumType } from "type-graphql";

import { AbstractFilterGroup, createFilterGroup } from "../Filter.js";
import { AbstractFilterGroup, createFilterGroup } from "./Filter.js";
import {
DEFAULT_PAGE_SIZE,
FIRST_PAGE,
SortDirection,
} from "../ListQueryTypes.js";
} from "./ListQueryTypes.js";

@InputType()
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
Expand All @@ -30,10 +34,37 @@ export function SortItem<Fields extends string>(
return Sort;
}

@InputType()
export abstract class AbstractSearchFilter<Field extends string> {
@Field(() => GraphQLNonEmptyString, {
nullable: false,
})
query!: string;
fields?: Field[] | null | undefined;
}

export function SearchFilter<Fields extends string>(
resolverName: string,
fieldsEnum: Record<string, Fields>
) {
@InputType(`${resolverName}SearchFilter`)
class SearchFilter extends AbstractSearchFilter<Fields> {
@Field(() => [fieldsEnum], {
nullable: true,
description:
"The fields to search in. If unspecified, searches all searchable fields. Note that searching by a field that does not support it will cause a runtime error",
})
fields?: Fields[] | null;
}

return SearchFilter;
}

@ArgsType()
export abstract class AbstractFilteredListQueryArgs<Fields extends string> {
filters!: AbstractFilterGroup<Fields> | null;
sortBy!: AbstractSortItem<Fields>[] | null;
search!: AbstractSearchFilter<Fields> | null;

@Field(() => Boolean, {
nullable: true,
Expand Down Expand Up @@ -85,6 +116,7 @@ export function FilteredListQueryArgs<Fields extends string>(

const FilterGroup = createFilterGroup(FilterKeysEnum, resolverName);
const Sort = SortItem(resolverName, FilterKeysEnum);
const Search = SearchFilter(resolverName, FilterKeysEnum);

@ArgsType()
abstract class FilteredListQueryArgs extends AbstractFilteredListQueryArgs<Fields> {
Expand All @@ -97,6 +129,9 @@ export function FilteredListQueryArgs<Fields extends string>(
"The fields to sort by, in order of priority. If unspecified, the sort order is undefined",
})
sortBy!: InstanceType<typeof Sort>[] | null;

@Field(() => Search, { nullable: true })
search!: InstanceType<typeof Search> | null;
}

return FilteredListQueryArgs;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { GraphQLLocalDate, GraphQLNonEmptyString } from "graphql-scalars";
import { ArgsType, Field, InputType, ObjectType } from "type-graphql";

import type { LocalDate } from "../../utility/time/localDate.js";
import { FilteredListQueryArgs } from "../filtering/list-query-args/FilteredListQueryArgs.js";
import { FilteredListQueryArgs } from "../filtering/FilteredListQueryArgs.js";
import { DailyDepartmentNotificationNode } from "../resources/DailyDepartmentNotification.js";
import { AbstractGraphQLPaginatedResponse } from "./ApiResponse.js";

Expand Down
2 changes: 1 addition & 1 deletion packages/common/lib/api/params/GetImageByUuidResponse.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { GraphQLNonEmptyString, GraphQLURL } from "graphql-scalars";
import { ArgsType, Field, InputType, ObjectType } from "type-graphql";

import { FilteredListQueryArgs } from "../filtering/list-query-args/FilteredListQueryArgs.js";
import { FilteredListQueryArgs } from "../filtering/FilteredListQueryArgs.js";
import { ImageNode } from "../resources/Image.js";
import { AbstractGraphQLPaginatedResponse } from "./ApiResponse.js";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { GraphQLNonEmptyString, GraphQLURL } from "graphql-scalars";
import { ArgsType, Field, InputType, Int, ObjectType } from "type-graphql";

import { FilteredListQueryArgs } from "../filtering/list-query-args/FilteredListQueryArgs.js";
import { FilteredListQueryArgs } from "../filtering/FilteredListQueryArgs.js";
import {
NotificationDeliveryNode,
NotificationNode,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { GraphQLNonEmptyString } from "graphql-scalars";
import { ArgsType, Field, InputType, Int, ObjectType } from "type-graphql";

import { FilteredListQueryArgs } from "../filtering/list-query-args/FilteredListQueryArgs.js";
import { FilteredListQueryArgs } from "../filtering/FilteredListQueryArgs.js";
import { PointEntryNode } from "../resources/PointEntry.js";
import { type GlobalId, GlobalIdScalar } from "../scalars/GlobalId.js";
import { AbstractGraphQLPaginatedResponse } from "./ApiResponse.js";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { GraphQLLocalDate, GraphQLNonEmptyString } from "graphql-scalars";
import { ArgsType, Field, Float, InputType, ObjectType } from "type-graphql";

import type { LocalDate } from "../../utility/time/localDate.js";
import { FilteredListQueryArgs } from "../filtering/list-query-args/FilteredListQueryArgs.js";
import { FilteredListQueryArgs } from "../filtering/FilteredListQueryArgs.js";
import { BatchType } from "../resources/DailyDepartmentNotification.js";
import { FundraisingEntryNode } from "../resources/Fundraising.js";
import { type GlobalId, GlobalIdScalar } from "../scalars/GlobalId.js";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { GraphQLNonEmptyString } from "graphql-scalars";
import { DateTime } from "luxon";
import { ArgsType, Field, InputType, ObjectType } from "type-graphql";

import { FilteredListQueryArgs } from "../filtering/list-query-args/FilteredListQueryArgs.js";
import { FilteredListQueryArgs } from "../filtering/FilteredListQueryArgs.js";
import { MarathonHourNode } from "../resources/MarathonHour.js";
import { DateTimeScalar } from "../scalars/DateTimeISO.js";
import { AbstractGraphQLPaginatedResponse } from "./ApiResponse.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/common/lib/api/params/ListMarathonsResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { GraphQLNonEmptyString } from "graphql-scalars";
import { DateTime } from "luxon";
import { ArgsType, Field, InputType, ObjectType } from "type-graphql";

import { FilteredListQueryArgs } from "../filtering/list-query-args/FilteredListQueryArgs.js";
import { FilteredListQueryArgs } from "../filtering/FilteredListQueryArgs.js";
import { MarathonNode } from "../resources/Marathon.js";
import { DateTimeScalar } from "../scalars/DateTimeISO.js";
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { GraphQLNonEmptyString } from "graphql-scalars";
import { DateTime } from "luxon";
import { ArgsType, Field, InputType, ObjectType } from "type-graphql";

import { FilteredListQueryArgs } from "../filtering/list-query-args/FilteredListQueryArgs.js";
import { FilteredListQueryArgs } from "../filtering/FilteredListQueryArgs.js";
import { PointOpportunityNode } from "../resources/PointOpportunity.js";
import { TeamType } from "../resources/Team.js";
import { DateTimeScalar } from "../scalars/DateTimeISO.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/common/lib/api/params/SingleTeamResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ArgsType, Field, InputType, Int, ObjectType } from "type-graphql";

import { DbRole } from "../../authorization/structures.js";
import { OptionalToNullable } from "../../utility/primitive/TypeUtils.js";
import { FilteredListQueryArgs } from "../filtering/list-query-args/FilteredListQueryArgs.js";
import { FilteredListQueryArgs } from "../filtering/FilteredListQueryArgs.js";
import { TeamLegacyStatus, TeamNode, TeamType } from "../resources/Team.js";
import { type GlobalId, GlobalIdScalar } from "../scalars/GlobalId.js";
import { AbstractGraphQLPaginatedResponse } from "./ApiResponse.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/common/lib/api/params/SolicitationCodeInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { IsAlpha, IsUppercase } from "class-validator";
import { GraphQLNonEmptyString, NonNegativeIntResolver } from "graphql-scalars";
import { ArgsType, Field, InputType, ObjectType } from "type-graphql";

import { FilteredListQueryArgs } from "../filtering/list-query-args/FilteredListQueryArgs.js";
import { FilteredListQueryArgs } from "../filtering/FilteredListQueryArgs.js";
import { SolicitationCodeNode } from "../resources/SolicitationCode.js";
import { AbstractGraphQLPaginatedResponse } from "./ApiResponse.js";

Expand Down
2 changes: 1 addition & 1 deletion packages/common/lib/api/params/deviceParams.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { GraphQLNonNegativeInt, GraphQLPositiveInt } from "graphql-scalars";
import { ArgsType, Field, InputType, ObjectType } from "type-graphql";

import { FilteredListQueryArgs } from "../filtering/list-query-args/FilteredListQueryArgs.js";
import { FilteredListQueryArgs } from "../filtering/FilteredListQueryArgs.js";
import { DeviceNode } from "../resources/Device.js";
import { GlobalId, GlobalIdScalar } from "../scalars/GlobalId.js";
import { AbstractGraphQLPaginatedResponse } from "./ApiResponse.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/common/lib/api/params/eventParams.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { GraphQLNonEmptyString } from "graphql-scalars";
import { ArgsType, Field, InputType, ObjectType } from "type-graphql";

import { FilteredListQueryArgs } from "../filtering/list-query-args/FilteredListQueryArgs.js";
import { FilteredListQueryArgs } from "../filtering/FilteredListQueryArgs.js";
import { EventNode } from "../resources/Event.js";
import { GlobalId, GlobalIdScalar } from "../scalars/GlobalId.js";
import { IntervalISO } from "../types/IntervalISO.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/common/lib/api/params/personParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
CommitteeRole,
DbRole,
} from "../../authorization/structures.js";
import { FilteredListQueryArgs } from "../filtering/list-query-args/FilteredListQueryArgs.js";
import { FilteredListQueryArgs } from "../filtering/FilteredListQueryArgs.js";
import { PersonNode } from "../resources/Person.js";
import { type GlobalId, GlobalIdScalar } from "../scalars/GlobalId.js";
import { AbstractGraphQLPaginatedResponse } from "./ApiResponse.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/common/lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import "reflect-metadata";

export * from "./api/filtering/Filter.js";
export * from "./api/filtering/list-query-args/FilteredListQueryArgs.js";
export * from "./api/filtering/FilteredListQueryArgs.js";
export * from "./api/filtering/ListQueryTypes.js";
export type * from "./api/jwt.js";
export * from "./api/params/index.js";
Expand Down
4 changes: 2 additions & 2 deletions packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@
"@casl/ability": "^6.7.2",
"@graphql-typed-document-node/core": "^3.2.0",
"class-validator": "^0.14.1",
"graphql": "^16.9.0",
"graphql": "^16.10.0",
"graphql-scalars": "^1.24.0",
"htmlparser2": "^9.1.0",
"htmlparser2": "^10.0.0",
"http-status-codes": "^2.3.0",
"luxon": "^3.5.0",
"reflect-metadata": "^0.2.2",
Expand Down
8 changes: 4 additions & 4 deletions packages/mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"test-with-coverage": "vitest --collect-coverage --collect-coverage-from=\"src/**/*..jsx,ts,tsx}\""
},
"dependencies": {
"@apollo/client": "3.11.10",
"@apollo/client": "3.12.4",
"@dev-plugins/async-storage": "^0.1.0",
"@expo/config-plugins": "~9.0.9",
"@expo/metro-runtime": "~4.0.0",
Expand Down Expand Up @@ -82,7 +82,7 @@
"expo-status-bar": "~2.0.0",
"expo-updates": "~0.26.7",
"expo-web-browser": "~14.0.1",
"graphql": "^16.9.0",
"graphql": "^16.10.0",
"graphql-scalars": "^1.24.0",
"lodash": "^4.17.21",
"luxon": "^3.5.0",
Expand Down Expand Up @@ -134,10 +134,10 @@
"@faker-js/faker": "^9.3.0",
"@testing-library/react-native": "^12.8.1",
"@types/babel__core": "^7.20.5",
"@types/lodash": "^4.17.13",
"@types/lodash": "^4.17.14",
"@types/luxon": "^3.4.2",
"@types/lz-string": "^1.5.0",
"@types/markdown-it": "^14",
"@types/markdown-it": "^14.1.2",
"@types/react": "~18.3.14",
"@types/react-dom": "~18.3.2",
"@types/react-native-rss-parser": "^1.4.3",
Expand Down
Loading

0 comments on commit 5260671

Please sign in to comment.