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

🎨 Improve code syntax with gql where applicable. #579

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
NEO4J_DIST='enterprise'
NEO4J_VERSION='4.2.0'
APOC_VERSION='4.2.0.0'
DATASTORE_VERSION='4_0'
NEO4J_USER=neo4j
NEO4J_PASSWORD=letmein
BOLT_PORT=7687
HTTP_PORT=3000
NEO4J_URI="bolt://localhost:{$BOLT_PORT}"
9 changes: 9 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
NEO4J_DIST='enterprise'
NEO4J_VERSION='4.2.0'
APOC_VERSION='4.2.0.0'
DATASTORE_VERSION='4_0'
NEO4J_USER=neo4j
NEO4J_PASSWORD=letmein
BOLT_PORT=7687
HTTP_PORT=3000
NEO4J_URI="bolt://localhost:{$BOLT_PORT}"
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,7 @@ neo4j-version
test/tck/*
!test/tck/.gitkeep

.history
.history

.download_cache
neo4j
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"vars":[{"line":0,"kind":2,"name":"strict","containerName":""},{"line":1,"name":"$regex","containerName":null,"kind":13,"localvar":"my","defintion":"my"},{"line":4,"name":"@ARGV","containerName":null,"kind":13}],"version":3}
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"avaExplorer.cwd": "test"
}
8 changes: 4 additions & 4 deletions example/apollo-federation/gateway.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ import { inventorySchema } from './services/inventory';
import { productsSchema } from './services/products';
import { reviewsSchema } from './services/reviews';
import neo4j from 'neo4j-driver';
import dotenv from 'dotenv';

dotenv.config();

// The schema and seed data are based on the Apollo Federation demo
// See: https://github.com/apollographql/federation-demo

const driver = neo4j.driver(
process.env.NEO4J_URI || 'bolt://localhost:7687',
neo4j.auth.basic(
process.env.NEO4J_USER || 'neo4j',
process.env.NEO4J_PASSWORD || 'letmein'
)
neo4j.auth.basic(process.env.NEO4J_USER, process.env.NEO4J_PASSWORD)
);

// Start Accounts
Expand Down
11 changes: 6 additions & 5 deletions example/apollo-server/authScopes.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { gql } from 'apollo-server';
import { makeAugmentedSchema } from '../../src/index';
import { ApolloServer } from 'apollo-server';
import neo4j from 'neo4j-driver';
Expand All @@ -11,15 +12,15 @@ import neo4j from 'neo4j-driver';
// JWT_SECRET
// oqldBPU1yMXcrTwcha1a9PGi9RHlPVzQ

const typeDefs = `
type User {
const typeDefs = gql`
type User {
userId: ID!
name: String
}
}

type Business {
type Business {
name: String
}
}
`;

const schema = makeAugmentedSchema({
Expand Down
74 changes: 37 additions & 37 deletions example/apollo-server/bookmarks.js
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
import { gql } from 'apollo-server';
import { makeAugmentedSchema } from '../../src/index';
import { ApolloServer } from 'apollo-server';
import neo4j from 'neo4j-driver';

const typeDefs = `
type Person {
_id: Long!
born: Int
name: String!
acted_in: [Movie] @relation(name: "ACTED_IN", direction: "OUT")
ACTED_IN_rel: [ACTED_IN]
directed: [Movie] @relation(name: "DIRECTED", direction: "OUT")
produced: [Movie] @relation(name: "PRODUCED", direction: "OUT")
wrote: [Movie] @relation(name: "WROTE", direction: "OUT")
follows: [Person] @relation(name: "FOLLOWS", direction: "OUT")
reviewed: [Movie] @relation(name: "REVIEWED", direction: "OUT")
REVIEWED_rel: [REVIEWED]
}

type Movie {
_id: Long!
released: Int!
tagline: String
title: String!
persons_acted_in: [Person] @relation(name: "ACTED_IN", direction: "IN")
persons_directed: [Person] @relation(name: "DIRECTED", direction: "IN")
persons_produced: [Person] @relation(name: "PRODUCED", direction: "IN")
persons_wrote: [Person] @relation(name: "WROTE", direction: "IN")
persons_reviewed: [Person] @relation(name: "REVIEWED", direction: "IN")
}
const typeDefs = gql`
type Person {
_id: Long!
born: Int
name: String!
acted_in: [Movie] @relation(name: "ACTED_IN", direction: "OUT")
ACTED_IN_rel: [ACTED_IN]
directed: [Movie] @relation(name: "DIRECTED", direction: "OUT")
produced: [Movie] @relation(name: "PRODUCED", direction: "OUT")
wrote: [Movie] @relation(name: "WROTE", direction: "OUT")
follows: [Person] @relation(name: "FOLLOWS", direction: "OUT")
reviewed: [Movie] @relation(name: "REVIEWED", direction: "OUT")
REVIEWED_rel: [REVIEWED]
}

type ACTED_IN @relation(name: "ACTED_IN") {
from: Person!
to: Movie!
roles: [String]!
}
type Movie {
_id: Long!
released: Int!
tagline: String
title: String!
persons_acted_in: [Person] @relation(name: "ACTED_IN", direction: "IN")
persons_directed: [Person] @relation(name: "DIRECTED", direction: "IN")
persons_produced: [Person] @relation(name: "PRODUCED", direction: "IN")
persons_wrote: [Person] @relation(name: "WROTE", direction: "IN")
persons_reviewed: [Person] @relation(name: "REVIEWED", direction: "IN")
}

type REVIEWED @relation(name: "REVIEWED") {
from: Person!
to: Movie!
rating: Int!
summary: String!
}
type ACTED_IN @relation(name: "ACTED_IN") {
from: Person!
to: Movie!
roles: [String]!
}

type REVIEWED @relation(name: "REVIEWED") {
from: Person!
to: Movie!
rating: Int!
summary: String!
}
`;

const schema = makeAugmentedSchema({ typeDefs });
Expand Down
32 changes: 18 additions & 14 deletions example/apollo-server/interface-union-example.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
import { gql } from 'apollo-server';
import { makeAugmentedSchema } from '../../src/index';
const { ApolloServer } = require('apollo-server');
const neo4j = require('neo4j-driver');

const __unionTypeDefs = `
union SearchResult = Blog | Movie
const __unionTypeDefs = gql`
union SearchResult = Blog | Movie

type Blog {
blogId: ID!
created: DateTime
content: String
}
type Blog {
blogId: ID!
created: DateTime
content: String
}

type Movie {
movieId: ID!
title: String
}
type Movie {
movieId: ID!
title: String
}

type Query {
search(searchString: String!): [SearchResult] @cypher(statement:"CALL db.index.fulltext.queryNodes('searchIndex', $searchString) YIELD node RETURN node")
}
type Query {
search(searchString: String!): [SearchResult]
@cypher(
statement: "CALL db.index.fulltext.queryNodes('searchIndex', $searchString) YIELD node RETURN node"
)
}
`;

const __interfaceTypeDefs = `
Expand Down
Loading