Skip to content

Commit

Permalink
Feat: PastFixture.opponent_team return Team instead of Int
Browse files Browse the repository at this point in the history
  • Loading branch information
AustinMusiku committed Sep 20, 2023
1 parent 873015b commit a2a9f08
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
5 changes: 4 additions & 1 deletion src/resolvers/pastFixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ export const PastFixture: PastFixtureResolvers = {
goals_scored: ({ goals_scored }) => goals_scored,
goals_conceded: ({ goals_conceded }) => goals_conceded,
minutes: ({ minutes }) => minutes,
opponent_team: ({ opponent_team }) => opponent_team,
opponent_team: async ({ opponent_team }, _, { loaders }) => {
const teamData = await loaders.teamData.load(opponent_team)
return teamData
},
own_goals: ({ own_goals }) => own_goals,
penalties_missed: ({ penalties_missed }) => penalties_missed,
penalties_saved: ({ penalties_saved }) => penalties_saved,
Expand Down
2 changes: 1 addition & 1 deletion src/typeDefs/index.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ type PastFixture {
goals_conceded: Int
goals_scored: Int
minutes: Int
opponent_team: Int
opponent_team: Team
own_goals: Int
penalties_missed: Int
penalties_saved: Int
Expand Down
9 changes: 5 additions & 4 deletions src/types/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { PastFixture as PastFixtureModel } from '@/models/pastFixture';
import { UpcomingFixture as UpcomingFixtureModel } from '@/models/upcomingFixture';
import { Team as TeamModel } from '@/models/team';
import { ElementType as ElementTypeModel } from '@/models/elementType';
import { Fixture as FixtureModel } from '@/models/fixture';
export type Maybe<T> = T | null;
export type InputMaybe<T> = Maybe<T>;
export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
Expand Down Expand Up @@ -96,7 +97,7 @@ export type PastFixture = {
goals_conceded?: Maybe<Scalars['Int']>;
goals_scored?: Maybe<Scalars['Int']>;
minutes?: Maybe<Scalars['Int']>;
opponent_team?: Maybe<Scalars['Int']>;
opponent_team?: Maybe<Team>;
own_goals?: Maybe<Scalars['Int']>;
penalties_missed?: Maybe<Scalars['Int']>;
penalties_saved?: Maybe<Scalars['Int']>;
Expand Down Expand Up @@ -387,7 +388,7 @@ export type ResolversTypes = {
Chip: ResolverTypeWrapper<ChipModel>;
ElementStats: ResolverTypeWrapper<ElementStats>;
ElementType: ResolverTypeWrapper<ElementTypeModel>;
Fixture: ResolverTypeWrapper<Fixture>;
Fixture: ResolverTypeWrapper<FixtureModel>;
FixtureStats: ResolverTypeWrapper<FixtureStats>;
Float: ResolverTypeWrapper<Scalars['Float']>;
GameWeek: ResolverTypeWrapper<GameWeekModel>;
Expand All @@ -406,7 +407,7 @@ export type ResolversParentTypes = {
Chip: ChipModel;
ElementStats: ElementStats;
ElementType: ElementTypeModel;
Fixture: Fixture;
Fixture: FixtureModel;
FixtureStats: FixtureStats;
Float: Scalars['Float'];
GameWeek: GameWeekModel;
Expand Down Expand Up @@ -494,7 +495,7 @@ export type PastFixtureResolvers<ContextType = any, ParentType extends Resolvers
goals_conceded?: Resolver<Maybe<ResolversTypes['Int']>, ParentType, ContextType>;
goals_scored?: Resolver<Maybe<ResolversTypes['Int']>, ParentType, ContextType>;
minutes?: Resolver<Maybe<ResolversTypes['Int']>, ParentType, ContextType>;
opponent_team?: Resolver<Maybe<ResolversTypes['Int']>, ParentType, ContextType>;
opponent_team?: Resolver<Maybe<ResolversTypes['Team']>, ParentType, ContextType>;
own_goals?: Resolver<Maybe<ResolversTypes['Int']>, ParentType, ContextType>;
penalties_missed?: Resolver<Maybe<ResolversTypes['Int']>, ParentType, ContextType>;
penalties_saved?: Resolver<Maybe<ResolversTypes['Int']>, ParentType, ContextType>;
Expand Down

0 comments on commit a2a9f08

Please sign in to comment.