Skip to content

Commit ffb187f

Browse files
authored
Merge pull request #41 from swcarlosrj/master
Apollo components update 🚀
2 parents 980e18a + b086369 commit ffb187f

File tree

18 files changed

+1864
-1176
lines changed

18 files changed

+1864
-1176
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
# dependencies
44
node_modules
5+
/server/node_modules
56
.graphcoolrc
67

78
# testing

LICENSE.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) [2017] [Graphcool]
3+
Copyright (c) [2018] [Graphcool]
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
21+
SOFTWARE.

package.json

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,17 @@
33
"version": "0.1.0",
44
"private": true,
55
"dependencies": {
6-
"apollo-client": "^2.2.0",
7-
"apollo-client-preset": "^1.0.6",
8-
"apollo-link": "^1.0.7",
9-
"apollo-link-ws": "^1.0.4",
10-
"graphql": "^0.12.3",
11-
"graphql-tag": "^2.6.1",
6+
"apollo-boost": "^0.1.4",
7+
"apollo-link-context": "^1.0.7",
8+
"apollo-link-ws": "^1.0.7",
9+
"graphql": "^0.13.1",
1210
"react": "^16.2.0",
13-
"react-apollo": "^2.0.4",
11+
"react-apollo": "^2.1.0",
1412
"react-dom": "^16.2.0",
1513
"react-router": "^4.2.0",
1614
"react-router-dom": "^4.2.2",
17-
"react-scripts": "1.0.17",
18-
"subscriptions-transport-ws": "^0.9.5"
15+
"react-scripts": "1.1.1",
16+
"subscriptions-transport-ws": "^0.9.7"
1917
},
2018
"scripts": {
2119
"start": "react-scripts start",

server/database/prisma.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ stage: dev
99
secret: mysecret123
1010

1111
# the file path pointing to your data model
12-
datamodel: datamodel.graphql
12+
datamodel: datamodel.graphql

server/src/generated/prisma.graphql

Lines changed: 29 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -141,16 +141,15 @@ input LinkUpdateManyWithoutPostedByInput {
141141
connect: [LinkWhereUniqueInput!]
142142
disconnect: [LinkWhereUniqueInput!]
143143
delete: [LinkWhereUniqueInput!]
144-
update: [LinkUpdateWithoutPostedByInput!]
145-
upsert: [LinkUpsertWithoutPostedByInput!]
144+
update: [LinkUpdateWithWhereUniqueWithoutPostedByInput!]
145+
upsert: [LinkUpsertWithWhereUniqueWithoutPostedByInput!]
146146
}
147147

148148
input LinkUpdateOneWithoutVotesInput {
149149
create: LinkCreateWithoutVotesInput
150150
connect: LinkWhereUniqueInput
151-
disconnect: LinkWhereUniqueInput
152-
delete: LinkWhereUniqueInput
153-
update: LinkUpdateWithoutVotesInput
151+
delete: Boolean
152+
update: LinkUpdateWithoutVotesDataInput
154153
upsert: LinkUpsertWithoutVotesInput
155154
}
156155

@@ -160,34 +159,28 @@ input LinkUpdateWithoutPostedByDataInput {
160159
votes: VoteUpdateManyWithoutLinkInput
161160
}
162161

163-
input LinkUpdateWithoutPostedByInput {
164-
where: LinkWhereUniqueInput!
165-
data: LinkUpdateWithoutPostedByDataInput!
166-
}
167-
168162
input LinkUpdateWithoutVotesDataInput {
169163
description: String
170164
url: String
171165
postedBy: UserUpdateOneWithoutLinksInput
172166
}
173167

174-
input LinkUpdateWithoutVotesInput {
175-
where: LinkWhereUniqueInput!
176-
data: LinkUpdateWithoutVotesDataInput!
177-
}
178-
179-
input LinkUpsertWithoutPostedByInput {
168+
input LinkUpdateWithWhereUniqueWithoutPostedByInput {
180169
where: LinkWhereUniqueInput!
181-
update: LinkUpdateWithoutPostedByDataInput!
182-
create: LinkCreateWithoutPostedByInput!
170+
data: LinkUpdateWithoutPostedByDataInput!
183171
}
184172

185173
input LinkUpsertWithoutVotesInput {
186-
where: LinkWhereUniqueInput!
187174
update: LinkUpdateWithoutVotesDataInput!
188175
create: LinkCreateWithoutVotesInput!
189176
}
190177

178+
input LinkUpsertWithWhereUniqueWithoutPostedByInput {
179+
where: LinkWhereUniqueInput!
180+
update: LinkUpdateWithoutPostedByDataInput!
181+
create: LinkCreateWithoutPostedByInput!
182+
}
183+
191184
input LinkWhereInput {
192185
AND: [LinkWhereInput!]
193186
OR: [LinkWhereInput!]
@@ -403,18 +396,17 @@ input UserUpdateInput {
403396
input UserUpdateOneWithoutLinksInput {
404397
create: UserCreateWithoutLinksInput
405398
connect: UserWhereUniqueInput
406-
disconnect: UserWhereUniqueInput
407-
delete: UserWhereUniqueInput
408-
update: UserUpdateWithoutLinksInput
399+
disconnect: Boolean
400+
delete: Boolean
401+
update: UserUpdateWithoutLinksDataInput
409402
upsert: UserUpsertWithoutLinksInput
410403
}
411404

412405
input UserUpdateOneWithoutVotesInput {
413406
create: UserCreateWithoutVotesInput
414407
connect: UserWhereUniqueInput
415-
disconnect: UserWhereUniqueInput
416-
delete: UserWhereUniqueInput
417-
update: UserUpdateWithoutVotesInput
408+
delete: Boolean
409+
update: UserUpdateWithoutVotesDataInput
418410
upsert: UserUpsertWithoutVotesInput
419411
}
420412

@@ -425,31 +417,19 @@ input UserUpdateWithoutLinksDataInput {
425417
votes: VoteUpdateManyWithoutUserInput
426418
}
427419

428-
input UserUpdateWithoutLinksInput {
429-
where: UserWhereUniqueInput!
430-
data: UserUpdateWithoutLinksDataInput!
431-
}
432-
433420
input UserUpdateWithoutVotesDataInput {
434421
name: String
435422
email: String
436423
password: String
437424
links: LinkUpdateManyWithoutPostedByInput
438425
}
439426

440-
input UserUpdateWithoutVotesInput {
441-
where: UserWhereUniqueInput!
442-
data: UserUpdateWithoutVotesDataInput!
443-
}
444-
445427
input UserUpsertWithoutLinksInput {
446-
where: UserWhereUniqueInput!
447428
update: UserUpdateWithoutLinksDataInput!
448429
create: UserCreateWithoutLinksInput!
449430
}
450431

451432
input UserUpsertWithoutVotesInput {
452-
where: UserWhereUniqueInput!
453433
update: UserUpdateWithoutVotesDataInput!
454434
create: UserCreateWithoutVotesInput!
455435
}
@@ -600,44 +580,44 @@ input VoteUpdateManyWithoutLinkInput {
600580
connect: [VoteWhereUniqueInput!]
601581
disconnect: [VoteWhereUniqueInput!]
602582
delete: [VoteWhereUniqueInput!]
603-
update: [VoteUpdateWithoutLinkInput!]
604-
upsert: [VoteUpsertWithoutLinkInput!]
583+
update: [VoteUpdateWithWhereUniqueWithoutLinkInput!]
584+
upsert: [VoteUpsertWithWhereUniqueWithoutLinkInput!]
605585
}
606586

607587
input VoteUpdateManyWithoutUserInput {
608588
create: [VoteCreateWithoutUserInput!]
609589
connect: [VoteWhereUniqueInput!]
610590
disconnect: [VoteWhereUniqueInput!]
611591
delete: [VoteWhereUniqueInput!]
612-
update: [VoteUpdateWithoutUserInput!]
613-
upsert: [VoteUpsertWithoutUserInput!]
592+
update: [VoteUpdateWithWhereUniqueWithoutUserInput!]
593+
upsert: [VoteUpsertWithWhereUniqueWithoutUserInput!]
614594
}
615595

616596
input VoteUpdateWithoutLinkDataInput {
617597
user: UserUpdateOneWithoutVotesInput
618598
}
619599

620-
input VoteUpdateWithoutLinkInput {
621-
where: VoteWhereUniqueInput!
622-
data: VoteUpdateWithoutLinkDataInput!
623-
}
624-
625600
input VoteUpdateWithoutUserDataInput {
626601
link: LinkUpdateOneWithoutVotesInput
627602
}
628603

629-
input VoteUpdateWithoutUserInput {
604+
input VoteUpdateWithWhereUniqueWithoutLinkInput {
605+
where: VoteWhereUniqueInput!
606+
data: VoteUpdateWithoutLinkDataInput!
607+
}
608+
609+
input VoteUpdateWithWhereUniqueWithoutUserInput {
630610
where: VoteWhereUniqueInput!
631611
data: VoteUpdateWithoutUserDataInput!
632612
}
633613

634-
input VoteUpsertWithoutLinkInput {
614+
input VoteUpsertWithWhereUniqueWithoutLinkInput {
635615
where: VoteWhereUniqueInput!
636616
update: VoteUpdateWithoutLinkDataInput!
637617
create: VoteCreateWithoutLinkInput!
638618
}
639619

640-
input VoteUpsertWithoutUserInput {
620+
input VoteUpsertWithWhereUniqueWithoutUserInput {
641621
where: VoteWhereUniqueInput!
642622
update: VoteUpdateWithoutUserDataInput!
643623
create: VoteCreateWithoutUserInput!

server/src/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const resolvers = {
99
Query,
1010
Mutation,
1111
Subscription,
12-
Feed,
12+
Feed
1313
}
1414

1515
const server = new GraphQLServer({
@@ -22,8 +22,8 @@ const server = new GraphQLServer({
2222
endpoint: '__PRISMA_ENDPOINT__',
2323
secret: 'mysecret123',
2424
debug: true
25-
}),
26-
}),
25+
})
26+
})
2727
})
2828

2929
server.start(() => console.log('Server is running on http://localhost:4000'))

server/src/resolvers/Mutation.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function post(parent, { url, description }, ctx, info) {
66
const userId = getUserId(ctx)
77
return ctx.db.mutation.createLink(
88
{ data: { url, description, postedBy: { connect: { id: userId } } } },
9-
info,
9+
info
1010
)
1111
}
1212

@@ -59,7 +59,7 @@ async function vote(parent, args, ctx, info) {
5959
link: { connect: { id: linkId } },
6060
},
6161
},
62-
info,
62+
info
6363
)
6464
}
6565

src/components/App.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,28 @@ import React, { Component } from 'react'
22
import LinkList from './LinkList'
33
import CreateLink from './CreateLink'
44
import Header from './Header'
5+
import { Switch, Route, Redirect } from 'react-router-dom'
56
import Login from './Login'
67
import Search from './Search'
7-
import { Switch, Route, Redirect } from 'react-router-dom'
88

99
class App extends Component {
1010
render() {
1111
return (
12-
<div className="center w85">
12+
<div className='center w85'>
1313
<Header />
14-
<div className="ph3 pv1 background-gray">
14+
<div className='ph3 pv1 background-gray'>
1515
<Switch>
16-
<Route exact path="/" render={() => <Redirect to="/new/1" />} />
17-
<Route exact path="/create" component={CreateLink} />
18-
<Route exact path="/login" component={Login} />
19-
<Route exact path="/search" component={Search} />
20-
<Route exact path="/top" component={LinkList} />
21-
<Route exact path="/new/:page" component={LinkList} />
16+
<Route exact path='/' render={() => <Redirect to='/new/1' />} />
17+
<Route exact path='/create' component={CreateLink} />
18+
<Route exact path='/login' component={Login} />
19+
<Route exact path='/search' component={Search} />
20+
<Route exact path='/top' component={LinkList} />
21+
<Route exact path='/new/:page' component={LinkList} />
2222
</Switch>
2323
</div>
2424
</div>
2525
)
2626
}
2727
}
2828

29-
export default App
29+
export default App

0 commit comments

Comments
 (0)