Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Graphql with gql.tada #1776

Open
wants to merge 69 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
69 commits
Select commit Hold shift click to select a range
6d303ff
infra: gql.tada initial config
fhenrich33 Nov 24, 2024
71fcfb4
feat: gql.tada implementation WIP
fhenrich33 Nov 24, 2024
d74cdab
refactor: infer types from graphql schema WIP
fhenrich33 Nov 25, 2024
e661590
refactor: infer types from graphql schema WIP
fhenrich33 Nov 25, 2024
5b836f7
chore: remove previous generated types
fhenrich33 Nov 25, 2024
9b79671
chore: remove previous generated types
fhenrich33 Nov 25, 2024
0da0966
refactor: infer types from graphql schema WIP
fhenrich33 Nov 25, 2024
15c5671
refactor: infer types from graphql schema WIP
fhenrich33 Nov 25, 2024
fcaf20c
refactor: infer types from graphql schema WIP
fhenrich33 Nov 25, 2024
672e937
chore: remove previous generated types
fhenrich33 Nov 25, 2024
d29d85c
Merge branch 'master' of https://github.com/boxwise/boxtribute into g…
fhenrich33 Nov 25, 2024
6e9b587
refactor: infer types from graphql schema WIP
fhenrich33 Nov 25, 2024
6006227
infra: fix lock file from merge
fhenrich33 Nov 25, 2024
1a67dd0
refactor: infer types from graphql schema WIP
fhenrich33 Nov 25, 2024
6876ceb
infra: generate and output gql types from single schema file
fhenrich33 Nov 25, 2024
a74dd77
infra: generate and output gql types from single schema file
fhenrich33 Nov 25, 2024
d9b873e
infra: disable field tracking on gql fragments
fhenrich33 Nov 25, 2024
28b5db7
infra: add type checking command to package.json
fhenrich33 Nov 25, 2024
d0c67af
Merge branch 'master' of https://github.com/boxwise/boxtribute into g…
fhenrich33 Nov 26, 2024
134bb7a
infra: update lock file due master merge
fhenrich33 Nov 26, 2024
355103c
refactor: infer types from graphql schema WIP
fhenrich33 Nov 26, 2024
11b2d21
refactor: infer types from graphql schema WIP
fhenrich33 Nov 26, 2024
f7f5317
refactor: infer types from graphql schema WIP
fhenrich33 Nov 26, 2024
21a7592
refactor: infer types from graphql schema WIP
fhenrich33 Nov 26, 2024
9d0c359
refactor: infer types from graphql schema WIP
fhenrich33 Nov 26, 2024
c84256d
refactor: infer types from graphql schema WIP
fhenrich33 Nov 26, 2024
f8df951
refactor: infer types from graphql schema WIP
fhenrich33 Nov 26, 2024
b71e997
refactor: infer types from graphql schema WIP
fhenrich33 Nov 26, 2024
1194b01
refactor: infer types from graphql schema WIP
fhenrich33 Nov 26, 2024
1b21642
fix: comment BE beta level check to fetch test token
fhenrich33 Nov 26, 2024
198c224
Merge branch 'master' of https://github.com/boxwise/boxtribute into g…
fhenrich33 Nov 26, 2024
fdbcdb2
infra: update lock from merge
fhenrich33 Nov 26, 2024
13403e4
refactor: infer types from graphql schema WIP
fhenrich33 Nov 26, 2024
a0feea4
refactor: infer types from graphql schema WIP
fhenrich33 Nov 26, 2024
286cfd8
refactor: infer types from graphql schema WIP
fhenrich33 Nov 26, 2024
176012f
refactor: infer types from graphql schema WIP
fhenrich33 Nov 26, 2024
5bc37c9
chore: remove console.log
fhenrich33 Nov 26, 2024
afb6f92
refactor: infer types from graphql schema WIP
fhenrich33 Nov 26, 2024
4aec1d0
chore: revert BE comment
fhenrich33 Nov 26, 2024
6f32176
Merge branch 'master' of https://github.com/boxwise/boxtribute into g…
fhenrich33 Nov 26, 2024
6fa04fe
refactor: infer types from graphql schema WIP
fhenrich33 Nov 26, 2024
145a7dd
refactor: infer types from graphql schema WIP
fhenrich33 Nov 26, 2024
0d2cdd9
refactor: infer types from graphql schema WIP
fhenrich33 Nov 26, 2024
66812c0
refactor: infer types from graphql schema WIP
fhenrich33 Nov 26, 2024
08e22b2
fix: somehow fixed boxView test...?
fhenrich33 Nov 26, 2024
5c5edbe
fix: infer shipmentDetail type from fragment
fhenrich33 Nov 26, 2024
46470f7
refactor: remove some any types
fhenrich33 Nov 27, 2024
3ce6edb
refactor: infer types from graphql schema
fhenrich33 Nov 27, 2024
4e8c293
refactor: remove some any types
fhenrich33 Nov 27, 2024
4880b89
refactor: move common graphql files to common folder in root project,…
fhenrich33 Nov 27, 2024
448d265
infra: removed unused packages
fhenrich33 Nov 27, 2024
ed32b90
Merge branch 'master' of https://github.com/boxwise/boxtribute into g…
fhenrich33 Nov 27, 2024
6e3b940
chore: add TODO about runnin pnpm graphql-gen in the project root
fhenrich33 Nov 27, 2024
931a945
refactor: dedupe fragments, move to local fragments, queries and types
fhenrich33 Nov 27, 2024
c2f60c3
refactor: dedupe fragments, move to local fragments, queries and types
fhenrich33 Nov 28, 2024
04fd081
refactor: dedupe fragments, move to local fragments, queries and types
fhenrich33 Nov 28, 2024
233fda0
infra: remove --no-frozen-lockfile due removal of potential conflicti…
fhenrich33 Nov 28, 2024
5b1f5c8
docs: add todos for better types, running graphql-gen on BE schema ch…
fhenrich33 Nov 28, 2024
5bef36d
Merge branch 'master' of https://github.com/boxwise/boxtribute into g…
fhenrich33 Nov 28, 2024
26faba2
Update graphql-gen workflow and integrate it with pre-commit
pylipp Nov 28, 2024
e353c3c
Merge branch 'master' of https://github.com/boxwise/boxtribute into g…
fhenrich33 Nov 29, 2024
5398fcd
Merge branch 'master' of https://github.com/boxwise/boxtribute into g…
fhenrich33 Dec 2, 2024
08b642f
Merge branch 'master' of https://github.com/boxwise/boxtribute into g…
fhenrich33 Dec 3, 2024
9c4f505
docs: add docs related to the new graphql setup, suggestions and conv…
fhenrich33 Dec 4, 2024
d326cde
infra: remove unused deps
fhenrich33 Dec 4, 2024
c53b669
Merge branch 'master' of https://github.com/boxwise/boxtribute into g…
fhenrich33 Dec 4, 2024
986a2a0
docs: Update README.md
fhenrich33 Dec 4, 2024
197d6e2
fix: fragment name
fhenrich33 Dec 5, 2024
f6c949f
infra: add back graphql gen command to CI
fhenrich33 Dec 5, 2024
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
Prev Previous commit
Next Next commit
refactor: infer types from graphql schema WIP
  • Loading branch information
fhenrich33 committed Nov 26, 2024
commit 13403e46750bfb8472ee2ab8d778723d59ddff46
3 changes: 3 additions & 0 deletions front/src/types/query-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 10,7 @@ import { MOVED_BOXES_QUERY } from "@boxtribute/shared-components/statviz/compone
import { STOCK_QUERY } from "@boxtribute/shared-components/statviz/components/visualizations/stock/StockDataContainer";
import { DEMOGRAPHIC_QUERY } from "@boxtribute/shared-components/statviz/components/visualizations/demographic/DemographicDataContainer";
import { BOXES_FOR_BOXESVIEW_QUERY } from "views/Boxes/BoxesView";
import { UPDATE_BOX_MUTATION } from "views/Box/BoxView";

export type BoxState = introspection_types["BoxState"]["enumValues"];
export type ShipmentState = introspection_types["ShipmentState"]["enumValues"];
Expand All @@ -22,6 23,8 @@ export type ShipmentDetail = Shipments[0]["details"][0];

export type Box = ResultOf<typeof BOX_QUERY>["box"];

export type UpdateBoxMutation = ResultOf<typeof UPDATE_BOX_MUTATION>["updateBox"];

export type User = ResultOf<typeof USER_QUERY>["users"][0];

export type Users = ResultOf<typeof USER_QUERY>["users"];
Expand Down
3 changes: 2 additions & 1 deletion front/src/views/Box/components/AssignBoxToShipment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 5,12 @@ import { IDropdownOption } from "components/Form/SelectField";
import { ShipmentOption } from "components/Form/ShipmentOption";
import { ResultOf } from "gql.tada";
import { BOX_BY_LABEL_IDENTIFIER_AND_ALL_SHIPMENTS_QUERY } from "queries/queries";
import { UpdateBoxMutation } from "types/query-types";

export interface IAssignBoxToShipmentProps {
boxData:
| ResultOf<typeof BOX_BY_LABEL_IDENTIFIER_AND_ALL_SHIPMENTS_QUERY>["box"]
| UpdateLocationOfBoxMutation["updateBox"];
| UpdateBoxMutation;
shipmentOptions: IDropdownOption[];
isAssignBoxesToShipmentLoading: boolean;
onAssignBoxesToShipment: (shipmentId: string) => void;
Expand Down
4 changes: 3 additions & 1 deletion front/src/views/Distributions/dataTransformers.ts
Original file line number Diff line number Diff line change
@@ -1,7 1,9 @@
import { ResultOf } from "gql.tada";
import { IPackingListEntryForPackingState } from "./types";
import { PACKING_LIST_ENTRIES_FOR_DISTRIBUTION_EVENT_QUERY } from "./queries";

export const graphqlPackingListEntriesForDistributionEventTransformer = (
queryResult: PackingListEntriesForDistributionEventQuery | undefined
queryResult: ResultOf<typeof PACKING_LIST_ENTRIES_FOR_DISTRIBUTION_EVENT_QUERY> | undefined
): IPackingListEntryForPackingState[] | undefined => {
// TODO: Do better (e.g. zod based) validation of the query result
return queryResult?.distributionEvent?.packingListEntries.map((entry) => {
Expand Down