Skip to content

Commit

Permalink
Export Typedefs, Cleanup Types
Browse files Browse the repository at this point in the history
  • Loading branch information
Saeris committed Aug 23, 2020
1 parent d892fcb commit a5a9432
Show file tree
Hide file tree
Showing 18 changed files with 20 additions and 82 deletions.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export { server } from "./server"
export { schema } from "./schema"
export { typeDefs, schema } from "./schema"
export { dataSources } from "./sources"
export { playground } from "./playground"
24 changes: 11 additions & 13 deletions src/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
URLScalar,
URL
} from "@saeris/graphql-scalars";
import { types, enums, inputs, interfaces, unions } from "./types";
import { types } from "./types";
import { resolvers } from "./resolvers";

// TODO: Re-Write Schema Definition to remove makeExecutableSchema entirely
Expand All @@ -36,19 +36,17 @@ const directives = Object.values(schemaDirectives).map(directive =>
directive.declaration()
);

export const typeDefs = [
...types,
DateTimeScalar,
EmailAddressScalar,
URLScalar,
cacheControlTypes,
...directives
];

export const schema = makeExecutableSchema({
typeDefs: [
...Object.values(types),
...Object.values(enums),
...Object.values(inputs),
...Object.values(interfaces),
...Object.values(unions),
DateTimeScalar,
EmailAddressScalar,
URLScalar,
cacheControlTypes,
...directives
],
typeDefs,
schemaDirectives,
resolvers: {
DateTime,
Expand Down
2 changes: 0 additions & 2 deletions src/types/cast.gql
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# import * from "./photo.gql"

type Cast {
id: ID!
castId: ID!
Expand Down
2 changes: 0 additions & 2 deletions src/types/company.gql
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# import * from "./logo.gql"

type Company {
id: ID!
name: String!
Expand Down
2 changes: 0 additions & 2 deletions src/types/crew.gql
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# import * from "./photo.gql"

type Crew {
id: ID!
creditId: ID!
Expand Down
7 changes: 0 additions & 7 deletions src/types/episode.gql
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
# import * from "./still.gql"
# import * from "./tv.gql"
# import * from "./season.gql"
# import * from "./cast.gql"
# import * from "./crew.gql"
# import * from "./guest.gql"

type Episode {
id: ID!
name: String!
Expand Down
2 changes: 0 additions & 2 deletions src/types/guest.gql
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# import * from "./photo.gql"

type Guest {
id: ID!
castID: ID!
Expand Down
13 changes: 8 additions & 5 deletions src/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import { enums } from "./enums"
import { inputs } from "./inputs"
import { interfaces } from "./interfaces"
import { unions } from "./unions"
import { default as Backdrop } from "./backdrop.gql"
import { default as Cast } from "./cast.gql"
import { default as Company } from "./company.gql"
Expand All @@ -20,12 +24,11 @@ import { default as Still } from "./still.gql"
import { default as TV } from "./tv.gql"
import { default as Video } from "./video.gql"

export { enums } from "./enums"
export { inputs } from "./inputs"
export { interfaces } from "./interfaces"
export { unions } from "./unions"

export const types = [
...enums,
...inputs,
...interfaces,
...unions,
Backdrop,
Cast,
Company,
Expand Down
2 changes: 0 additions & 2 deletions src/types/inputs/videoFilter.gql
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# import * from "../enums/videoType.gql"

input VideoFilter {
site: [String!]
type: [VideoType!]
Expand Down
9 changes: 0 additions & 9 deletions src/types/movie.gql
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
# import * from "./enums/releaseStatus.gql"
# import * from "./poster.gql"
# import * from "./backdrop.gql"
# import * from "./genre.gql"
# import * from "./language.gql"
# import * from "./cast.gql"
# import * from "./crew.gql"
# import * from "./video.gql"

type Movie @cacheControl(maxAge: 60) {
id: ID!
title: String! @cacheControl(maxAge: 3600)
Expand Down
3 changes: 0 additions & 3 deletions src/types/person.gql
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# import * from "./photo.gql"
# import * from "./movie.gql"

type Person {
id: ID!
name: String!
Expand Down
5 changes: 0 additions & 5 deletions src/types/query.gql
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
# import * from "./movie.gql"
# import * from "./person.gql"
# import * from "./tv.gql"
# import * from "./unions/searchResult.gql"

type Query {
movie(id: ID!): Movie!
person(id: ID!): Person!
Expand Down
2 changes: 0 additions & 2 deletions src/types/schema.gql
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# import * from "./query.gql"

schema {
query: Query
}
4 changes: 0 additions & 4 deletions src/types/season.gql
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# import * from "./poster.gql"
# import * from "./tv.gql"
# import * from "./episode.gql"

type Season {
id: ID!
name: String!
Expand Down
14 changes: 0 additions & 14 deletions src/types/tv.gql
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
# import * from "./enums/tvType.gql"
# import * from "./enums/tvStatus.gql"
# import * from "./genre.gql"
# import * from "./person.gql"
# import * from "./cast.gql"
# import * from "./crew.gql"
# import * from "./network.gql"
# import * from "./company.gql"
# import * from "./poster.gql"
# import * from "./backdrop.gql"
# import * from "./video.gql"
# import * from "./season.gql"
# import * from "./episode.gql"

type TV {
id: ID!

Expand Down
3 changes: 0 additions & 3 deletions src/types/unions/media.gql
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
# import * from "../movie.gql"
# import * from "../tv.gql"

union Media = Movie | TV
4 changes: 0 additions & 4 deletions src/types/unions/searchResult.gql
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
# import * from "../movie.gql"
# import * from "../person.gql"
# import * from "../tv.gql"

union SearchResult = Movie | Person | TV
2 changes: 0 additions & 2 deletions src/types/video.gql
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# import * from "./enums/videoType.gql"

type Video {
id: ID!
key: String!
Expand Down

0 comments on commit a5a9432

Please sign in to comment.