Skip to content
This repository was archived by the owner on Sep 3, 2021. It is now read-only.

Commit 18dad6b

Browse files
author
Daniel Kaminski de Souza
committed
🎨 Improve code syntax with gql where applicable.
🐛 a sudo should fix install-neo4j.sh. 🐛 Nevermind local .env file for now. 🎨 Improve code syntax with gql where applicable.
1 parent 53733c5 commit 18dad6b

File tree

8 files changed

+288
-238
lines changed

8 files changed

+288
-238
lines changed

.gitignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,10 @@ neo4j-version
6969
test/tck/*
7070
!test/tck/.gitkeep
7171

72-
.history
72+
.history
73+
74+
__MACOSX
75+
neo4j
76+
77+
neo4j-enterprise*
78+
recommendations.db.zip*

example/apollo-server/authScopes.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { gql } from 'apollo-server';
12
import { makeAugmentedSchema } from '../../src/index';
23
import { ApolloServer } from 'apollo-server';
34
import neo4j from 'neo4j-driver';
@@ -11,15 +12,15 @@ import neo4j from 'neo4j-driver';
1112
// JWT_SECRET
1213
// oqldBPU1yMXcrTwcha1a9PGi9RHlPVzQ
1314

14-
const typeDefs = `
15-
type User {
15+
const typeDefs = gql`
16+
type User {
1617
userId: ID!
1718
name: String
18-
}
19+
}
1920
20-
type Business {
21+
type Business {
2122
name: String
22-
}
23+
}
2324
`;
2425

2526
const schema = makeAugmentedSchema({

example/apollo-server/bookmarks.js

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,47 @@
1+
import { gql } from 'apollo-server';
12
import { makeAugmentedSchema } from '../../src/index';
23
import { ApolloServer } from 'apollo-server';
34
import neo4j from 'neo4j-driver';
45

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+
}
3120
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+
}
3732
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+
}
4438
39+
type REVIEWED @relation(name: "REVIEWED") {
40+
from: Person!
41+
to: Movie!
42+
rating: Int!
43+
summary: String!
44+
}
4545
`;
4646

4747
const schema = makeAugmentedSchema({ typeDefs });

example/apollo-server/interface-union-example.js

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,28 @@
1+
import { gql } from 'apollo-server';
12
import { makeAugmentedSchema } from '../../src/index';
23
const { ApolloServer } = require('apollo-server');
34
const neo4j = require('neo4j-driver');
45

5-
const __unionTypeDefs = `
6-
union SearchResult = Blog | Movie
6+
const __unionTypeDefs = gql`
7+
union SearchResult = Blog | Movie
78
8-
type Blog {
9-
blogId: ID!
10-
created: DateTime
11-
content: String
12-
}
9+
type Blog {
10+
blogId: ID!
11+
created: DateTime
12+
content: String
13+
}
1314
14-
type Movie {
15-
movieId: ID!
16-
title: String
17-
}
15+
type Movie {
16+
movieId: ID!
17+
title: String
18+
}
1819
19-
type Query {
20-
search(searchString: String!): [SearchResult] @cypher(statement:"CALL db.index.fulltext.queryNodes('searchIndex', $searchString) YIELD node RETURN node")
21-
}
20+
type Query {
21+
search(searchString: String!): [SearchResult]
22+
@cypher(
23+
statement: "CALL db.index.fulltext.queryNodes('searchIndex', $searchString) YIELD node RETURN node"
24+
)
25+
}
2226
`;
2327

2428
const __interfaceTypeDefs = `

0 commit comments

Comments
 (0)