Skip to content

Commit f987a0d

Browse files
committed
minor updates
1 parent ed1731f commit f987a0d

File tree

9 files changed

+1480
-1821
lines changed

9 files changed

+1480
-1821
lines changed

.DS_Store

0 Bytes
Binary file not shown.

.nvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
14

api/.DS_Store

6 KB
Binary file not shown.

api/src/generated/graphql-types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export type InputMaybe<T> = Maybe<T>;
55
export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
66
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
77
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
8-
export type RequireFields<T, K extends keyof T> = { [X in Exclude<keyof T, K>]?: T[X] } & { [P in K]-?: NonNullable<T[P]> };
8+
export type RequireFields<T, K extends keyof T> = Omit<T, K> & { [P in K]-?: NonNullable<T[P]> };
99
/** All built-in and custom scalars, mapped to their actual values */
1010
export type Scalars = {
1111
ID: string;

app/src/generated/graphql.tsx

+16-48
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export type InputMaybe<T> = Maybe<T>;
55
export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
66
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
77
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
8-
const defaultOptions = {}
8+
const defaultOptions = {} as const;
99
/** All built-in and custom scalars, mapped to their actual values */
1010
export type Scalars = {
1111
ID: string;
@@ -76,31 +76,26 @@ export type MovieByIdQueryVariables = Exact<{
7676
}>;
7777

7878

79-
export type MovieByIdQuery = { __typename?: 'Query', movieById?: { __typename?: 'Movie', id: string, title: string, overview: string, poster_path: string, backdrop_path?: string | null | undefined, favorite?: boolean | null | undefined, cast?: Array<{ __typename?: 'Credit', id: string, name: string }> | null | undefined } | null | undefined };
79+
export type MovieByIdQuery = { __typename?: 'Query', movieById?: { __typename?: 'Movie', id: string, title: string, overview: string, poster_path: string, backdrop_path?: string | null, favorite?: boolean | null, cast?: Array<{ __typename?: 'Credit', id: string, name: string }> | null } | null };
8080

8181
export type ToggleFavoriteMutationVariables = Exact<{
8282
movieId: Scalars['ID'];
8383
}>;
8484

8585

86-
export type ToggleFavoriteMutation = { __typename?: 'Mutation', toggleFavoriteMovie?: { __typename?: 'Movie', id: string, favorite?: boolean | null | undefined } | null | undefined };
87-
88-
export type NowPlayingQueryQueryVariables = Exact<{ [key: string]: never; }>;
89-
90-
91-
export type NowPlayingQueryQuery = { __typename?: 'Query', nowPlaying?: Array<{ __typename?: 'Movie', id: string, title: string, overview: string }> | null | undefined };
92-
93-
export type MovieFragment = { __typename?: 'Movie', id: string, title: string, overview: string, poster_path: string, backdrop_path?: string | null | undefined, favorite?: boolean | null | undefined, popularity?: string | null | undefined, cast?: Array<{ __typename?: 'Credit', name: string }> | null | undefined };
86+
export type ToggleFavoriteMutation = { __typename?: 'Mutation', toggleFavoriteMovie?: { __typename?: 'Movie', id: string, favorite?: boolean | null } | null };
9487

9588
export type NowPlayingQueryVariables = Exact<{ [key: string]: never; }>;
9689

9790

98-
export type NowPlayingQuery = { __typename?: 'Query', nowPlaying?: Array<{ __typename?: 'Movie', id: string, title: string, overview: string, poster_path: string, backdrop_path?: string | null | undefined, favorite?: boolean | null | undefined, popularity?: string | null | undefined, cast?: Array<{ __typename?: 'Credit', name: string }> | null | undefined }> | null | undefined };
91+
export type NowPlayingQuery = { __typename?: 'Query', nowPlaying?: Array<{ __typename?: 'Movie', id: string, title: string, overview: string, poster_path: string, backdrop_path?: string | null, favorite?: boolean | null, popularity?: string | null, cast?: Array<{ __typename?: 'Credit', name: string }> | null }> | null };
92+
93+
export type MovieFragment = { __typename?: 'Movie', id: string, title: string, overview: string, poster_path: string, backdrop_path?: string | null, favorite?: boolean | null, popularity?: string | null, cast?: Array<{ __typename?: 'Credit', name: string }> | null };
9994

10095
export type PopularQueryVariables = Exact<{ [key: string]: never; }>;
10196

10297

103-
export type PopularQuery = { __typename?: 'Query', popular?: Array<{ __typename?: 'Movie', id: string, title: string, overview: string, poster_path: string, backdrop_path?: string | null | undefined, favorite?: boolean | null | undefined, popularity?: string | null | undefined, cast?: Array<{ __typename?: 'Credit', name: string }> | null | undefined }> | null | undefined };
98+
export type PopularQuery = { __typename?: 'Query', popular?: Array<{ __typename?: 'Movie', id: string, title: string, overview: string, poster_path: string, backdrop_path?: string | null, favorite?: boolean | null, popularity?: string | null, cast?: Array<{ __typename?: 'Credit', name: string }> | null }> | null };
10499

105100
export const MovieFragmentDoc = gql`
106101
fragment Movie on Movie {
@@ -194,50 +189,23 @@ export function useToggleFavoriteMutation(baseOptions?: Apollo.MutationHookOptio
194189
export type ToggleFavoriteMutationHookResult = ReturnType<typeof useToggleFavoriteMutation>;
195190
export type ToggleFavoriteMutationResult = Apollo.MutationResult<ToggleFavoriteMutation>;
196191
export type ToggleFavoriteMutationOptions = Apollo.BaseMutationOptions<ToggleFavoriteMutation, ToggleFavoriteMutationVariables>;
197-
export const NowPlayingQueryDocument = gql`
198-
query nowPlayingQuery {
192+
export const NowPlayingDocument = gql`
193+
query nowPlaying {
199194
nowPlaying {
200195
id
201196
title
202197
overview
198+
poster_path
199+
backdrop_path
200+
favorite
201+
popularity
202+
cast {
203+
name
204+
}
203205
}
204206
}
205207
`;
206208

207-
/**
208-
* __useNowPlayingQueryQuery__
209-
*
210-
* To run a query within a React component, call `useNowPlayingQueryQuery` and pass it any options that fit your needs.
211-
* When your component renders, `useNowPlayingQueryQuery` returns an object from Apollo Client that contains loading, error, and data properties
212-
* you can use to render your UI.
213-
*
214-
* @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
215-
*
216-
* @example
217-
* const { data, loading, error } = useNowPlayingQueryQuery({
218-
* variables: {
219-
* },
220-
* });
221-
*/
222-
export function useNowPlayingQueryQuery(baseOptions?: Apollo.QueryHookOptions<NowPlayingQueryQuery, NowPlayingQueryQueryVariables>) {
223-
const options = {...defaultOptions, ...baseOptions}
224-
return Apollo.useQuery<NowPlayingQueryQuery, NowPlayingQueryQueryVariables>(NowPlayingQueryDocument, options);
225-
}
226-
export function useNowPlayingQueryLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<NowPlayingQueryQuery, NowPlayingQueryQueryVariables>) {
227-
const options = {...defaultOptions, ...baseOptions}
228-
return Apollo.useLazyQuery<NowPlayingQueryQuery, NowPlayingQueryQueryVariables>(NowPlayingQueryDocument, options);
229-
}
230-
export type NowPlayingQueryQueryHookResult = ReturnType<typeof useNowPlayingQueryQuery>;
231-
export type NowPlayingQueryLazyQueryHookResult = ReturnType<typeof useNowPlayingQueryLazyQuery>;
232-
export type NowPlayingQueryQueryResult = Apollo.QueryResult<NowPlayingQueryQuery, NowPlayingQueryQueryVariables>;
233-
export const NowPlayingDocument = gql`
234-
query nowPlaying {
235-
nowPlaying {
236-
...Movie
237-
}
238-
}
239-
${MovieFragmentDoc}`;
240-
241209
/**
242210
* __useNowPlayingQuery__
243211
*

app/src/pages/NowPlaying.tsx

-10
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,7 @@ import React from 'react';
33
import { Carousel } from '../components/slider/Carousel';
44
import { MoviePoster } from '../components/slider/MoviePoster';
55
import { useNowPlayingQuery } from '../generated/graphql';
6-
import { gql } from '@apollo/client';
76

8-
export const nowPlayingQuery = gql`
9-
query nowPlayingQuery {
10-
nowPlaying {
11-
id
12-
title
13-
overview
14-
}
15-
}
16-
`;
177

188
export const NowPlaying = () => {
199
const { loading, error, data } = useNowPlayingQuery();

app/src/pages/graphql.ts

+17-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
import { gql } from '@apollo/client';
22

3+
export const NOW_PLAYING = gql`
4+
query nowPlaying {
5+
nowPlaying {
6+
id
7+
title
8+
overview
9+
poster_path
10+
backdrop_path
11+
favorite
12+
popularity
13+
cast {
14+
name
15+
}
16+
}
17+
}
18+
`;
19+
320
export const MOVIE_FRAGMENT = gql`
421
fragment Movie on Movie {
522
id
@@ -15,15 +32,6 @@ export const MOVIE_FRAGMENT = gql`
1532
}
1633
`;
1734

18-
export const NOW_PLAYING = gql`
19-
query nowPlaying {
20-
nowPlaying {
21-
...Movie
22-
}
23-
}
24-
${MOVIE_FRAGMENT}
25-
`;
26-
2735
export const POPULAR = gql`
2836
query popular {
2937
popular {

package.json

+9-10
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,16 @@
1111
"codegen": "graphql-codegen --config codegen.yml"
1212
},
1313
"devDependencies": {
14-
"@graphql-codegen/cli": "1.17.8",
14+
"@graphql-codegen/cli": "2.11.3",
15+
"@graphql-codegen/introspection": "2.2.0",
16+
"@graphql-codegen/typescript": "2.7.2",
17+
"@graphql-codegen/typescript-operations": "2.5.2",
18+
"@graphql-codegen/typescript-react-apollo": "3.3.2",
19+
"@graphql-codegen/typescript-resolvers": "2.7.2",
1520
"npm-run-all": "^4.1.5",
16-
"typescript": "^3.9.7",
17-
"@graphql-codegen/typescript": "1.17.8",
18-
"@graphql-codegen/typescript-operations": "1.17.8",
19-
"@graphql-codegen/typescript-resolvers": "1.17.8",
20-
"@graphql-codegen/typescript-react-apollo": "1.17.8",
21-
"@graphql-codegen/introspection": "1.17.8"
21+
"typescript": "^4.7.4"
2222
},
2323
"dependencies": {
24-
"apollo-datasource-rest": "^0.9.3",
25-
"graphql": "^15.3.0"
24+
"graphql": "^16.5.0"
2625
}
27-
}
26+
}

0 commit comments

Comments
 (0)