|
| 1 | +import { gql } from 'apollo-server'; |
1 | 2 | import { makeAugmentedSchema } from '../../src/index'; |
2 | 3 | import { ApolloServer } from 'apollo-server'; |
3 | 4 | import neo4j from 'neo4j-driver'; |
4 | 5 |
|
5 | | -const typeDefs = ` |
6 | | -type Person { |
7 | | - _id: Long! |
8 | | - born: Int |
9 | | - name: String! |
10 | | - acted_in: [Movie] @relation(name: "ACTED_IN", direction: "OUT") |
11 | | - ACTED_IN_rel: [ACTED_IN] |
12 | | - directed: [Movie] @relation(name: "DIRECTED", direction: "OUT") |
13 | | - produced: [Movie] @relation(name: "PRODUCED", direction: "OUT") |
14 | | - wrote: [Movie] @relation(name: "WROTE", direction: "OUT") |
15 | | - follows: [Person] @relation(name: "FOLLOWS", direction: "OUT") |
16 | | - reviewed: [Movie] @relation(name: "REVIEWED", direction: "OUT") |
17 | | - REVIEWED_rel: [REVIEWED] |
18 | | -} |
19 | | -
|
20 | | -type Movie { |
21 | | - _id: Long! |
22 | | - released: Int! |
23 | | - tagline: String |
24 | | - title: String! |
25 | | - persons_acted_in: [Person] @relation(name: "ACTED_IN", direction: "IN") |
26 | | - persons_directed: [Person] @relation(name: "DIRECTED", direction: "IN") |
27 | | - persons_produced: [Person] @relation(name: "PRODUCED", direction: "IN") |
28 | | - persons_wrote: [Person] @relation(name: "WROTE", direction: "IN") |
29 | | - persons_reviewed: [Person] @relation(name: "REVIEWED", direction: "IN") |
30 | | -} |
| 6 | +const typeDefs = gql` |
| 7 | + type Person { |
| 8 | + _id: Long! |
| 9 | + born: Int |
| 10 | + name: String! |
| 11 | + acted_in: [Movie] @relation(name: "ACTED_IN", direction: "OUT") |
| 12 | + ACTED_IN_rel: [ACTED_IN] |
| 13 | + directed: [Movie] @relation(name: "DIRECTED", direction: "OUT") |
| 14 | + produced: [Movie] @relation(name: "PRODUCED", direction: "OUT") |
| 15 | + wrote: [Movie] @relation(name: "WROTE", direction: "OUT") |
| 16 | + follows: [Person] @relation(name: "FOLLOWS", direction: "OUT") |
| 17 | + reviewed: [Movie] @relation(name: "REVIEWED", direction: "OUT") |
| 18 | + REVIEWED_rel: [REVIEWED] |
| 19 | + } |
31 | 20 |
|
32 | | -type ACTED_IN @relation(name: "ACTED_IN") { |
33 | | - from: Person! |
34 | | - to: Movie! |
35 | | - roles: [String]! |
36 | | -} |
| 21 | + type Movie { |
| 22 | + _id: Long! |
| 23 | + released: Int! |
| 24 | + tagline: String |
| 25 | + title: String! |
| 26 | + persons_acted_in: [Person] @relation(name: "ACTED_IN", direction: "IN") |
| 27 | + persons_directed: [Person] @relation(name: "DIRECTED", direction: "IN") |
| 28 | + persons_produced: [Person] @relation(name: "PRODUCED", direction: "IN") |
| 29 | + persons_wrote: [Person] @relation(name: "WROTE", direction: "IN") |
| 30 | + persons_reviewed: [Person] @relation(name: "REVIEWED", direction: "IN") |
| 31 | + } |
37 | 32 |
|
38 | | -type REVIEWED @relation(name: "REVIEWED") { |
39 | | - from: Person! |
40 | | - to: Movie! |
41 | | - rating: Int! |
42 | | - summary: String! |
43 | | -} |
| 33 | + type ACTED_IN @relation(name: "ACTED_IN") { |
| 34 | + from: Person! |
| 35 | + to: Movie! |
| 36 | + roles: [String]! |
| 37 | + } |
44 | 38 |
|
| 39 | + type REVIEWED @relation(name: "REVIEWED") { |
| 40 | + from: Person! |
| 41 | + to: Movie! |
| 42 | + rating: Int! |
| 43 | + summary: String! |
| 44 | + } |
45 | 45 | `; |
46 | 46 |
|
47 | 47 | const schema = makeAugmentedSchema({ typeDefs }); |
|
0 commit comments