Skip to content
Merged
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
8,764 changes: 2,314 additions & 6,450 deletions final/server/package-lock.json

Large diffs are not rendered by default.

11 changes: 5 additions & 6 deletions final/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@
"author": "",
"license": "ISC",
"dependencies": {
"apollo-datasource": "^0.1.3",
"apollo-datasource-rest": "^0.1.5",
"apollo-server": "^2.25.2",
"apollo-server-testing": "^2.25.2",
"apollo-datasource": "^3.1.0",
"apollo-datasource-rest": "^3.2.0",
"apollo-server": "^3.2.0",
"aws-sdk": "^2.585.0",
"dotenv": "^6.2.0",
"graphql": "^14.6.0",
"graphql": "^15.5.1",
"isemail": "^3.1.3",
"mime": "^2.4.4",
"nodemon": "^1.19.4",
Expand All @@ -26,7 +25,7 @@
"uuid": "^3.3.3"
},
"devDependencies": {
"@apollo/rover": "^0.1.10",
"@apollo/rover": "^0.2.0",
"apollo-link": "^1.2.3",
"apollo-link-http": "^1.5.5",
"jest": "^25.0.0",
Expand Down
22 changes: 8 additions & 14 deletions final/server/src/__tests__/integration.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const {createTestClient} = require('apollo-server-testing');
const gql = require('graphql-tag');
const nock = require('nock');

Expand Down Expand Up @@ -83,11 +82,9 @@ describe('Queries', () => {
{dataValues: {launchId: 1}},
]);

// use our test server as input to the createTestClient fn
// This will give us an interface, similar to apolloClient.query
// to run queries against our instance of ApolloServer
const {query} = createTestClient(server);
const res = await query({query: GET_LAUNCHES});
// We use server.executeOperation to run test queries
// against our instance of ApolloServer
const res = await server.executeOperation({query: GET_LAUNCHES});
expect(res).toMatchSnapshot();
});

Expand All @@ -102,8 +99,7 @@ describe('Queries', () => {
{dataValues: {launchId: 1}},
]);

const {query} = createTestClient(server);
const res = await query({query: GET_LAUNCH, variables: {id: 1}});
const res = await server.executeOperation({query: GET_LAUNCH, variables: {id: 1}});
expect(res).toMatchSnapshot();
});
});
Expand All @@ -119,9 +115,8 @@ describe('Mutations', () => {
{id: 1, email: 'a@a.a'},
]);

const {mutate} = createTestClient(server);
const res = await mutate({
mutation: LOGIN,
const res = await server.executeOperation({
query: LOGIN,
variables: {email: 'a@a.a'},
});
expect(res.data.login.token).toEqual('YUBhLmE=');
Expand Down Expand Up @@ -149,9 +144,8 @@ describe('Mutations', () => {
// check if user is booked
userAPI.store.trips.findAll.mockReturnValue([{}]);

const {mutate} = createTestClient(server);
const res = await mutate({
mutation: BOOK_TRIPS,
const res = await server.executeOperation({
query: BOOK_TRIPS,
variables: {launchIds: ['1', '2']},
});
expect(res).toMatchSnapshot();
Expand Down
9 changes: 0 additions & 9 deletions final/server/src/engine-demo.js

This file was deleted.

4 changes: 0 additions & 4 deletions final/server/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ const { createStore } = require('./utils');
const LaunchAPI = require('./datasources/launch');
const UserAPI = require('./datasources/user');

const internalEngineDemo = require('./engine-demo');

// creates a sequelize connection once. NOT for every request
const store = createStore();

Expand Down Expand Up @@ -43,10 +41,8 @@ const server = new ApolloServer({
dataSources,
context,
introspection: true,
playground: true,
apollo: {
key: process.env.APOLLO_KEY,
...internalEngineDemo,
},
});

Expand Down
2 changes: 0 additions & 2 deletions final/server/src/resolvers.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ module.exports = {
return user;
}
},
uploadProfileImage: async(_, { file }, { dataSources }) =>
dataSources.userAPI.uploadProfileImage({ file }),
},
Launch: {
isBooked: async (launch, _, { dataSources }) =>
Expand Down
3 changes: 0 additions & 3 deletions final/server/src/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ const typeDefs = gql`
cancelTrip(launchId: ID!): TripUpdateResponse!

login(email: String): User

# for use with the iOS tutorial
uploadProfileImage(file: Upload!): User
}

type TripUpdateResponse {
Expand Down
Loading